Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8287265
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T11:59:18+00:00 2026-06-08T11:59:18+00:00

I am developing an iPhone app. In the app, I need to load a

  • 0

I am developing an iPhone app. In the app, I need to load a lot of data (JSON) from the web and then create the view accordingly. Please suggest me how to proceed.

Basically what I am doing is

1. Load a json from array a web-service.

2. The array received above contains urls to other web services. Lets say, 8

3. So now I need call 8 web services and after fetching, I have to parse the data and then show this to user.

Its the first time I am dealing with a web-service. So have no idea how to do that.

the major problem is the time consumption. How can I implement multithreading in it?

Please suggest any idea or link that could help me.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T11:59:19+00:00Added an answer on June 8, 2026 at 11:59 am

    What i’d do:

    1. Create a new NSThread and corresponding @autoreleasepool which loads the first json
    2. Once the ‘main JSON’ data is loaded: Put all the url’s into a NSMutableArray
    3. Load the JSON date of the first URL (again in the same thread) of the above array
    4. Once the JSON data is loaded, store the JSON data
    5. Remove the first element from the array you created in [2].
    6. If your array isn’t empty > goto step 3.

    Something like this?
    (haven’t tested it):

    #import "JSONKit.h"
    - (void)viewDidLoad {
        [super viewDidLoad];    
        [NSThread detachNewThreadSelector:@selector(_loadJSON) toTarget:self withObject:nil];
    };
    
    -(void)_startNewThread {
        @autoreleasepool {
            NSError *error = nil;
            /*
             main json file:
             [
                 { "url": "http://domain.com/file2.json" },
                 { "url": "http://domain2.com/file.json" },
                 { "url": "http://domain3.com/file.json" }
            ]
        */   
        NSMutableArray *mainUrls = [[NSString stringWithContentsOfURL:[NSURL URLWithString:@"http://domain.com/file.json"] encoding:NSUTF8StringEncoding error:&error] mutableObjectFromJSONString];
        NSMutableArray *returnArray = [[NSMutableArray alloc] init];
        if (error == nil) {
            while ([mainUrls count]) {
                NSURL *url = [NSURL URLWithString:[[mainUrls objectAtIndex:0] objectForKey:@"url"]];
                NSDictionary *dictionary = [[NSString stringWithContentsOfURL:url encoding:NSUTF8StringEncoding error:&error] objectFromJSONString];
                if (error == nil) {
                    [returnArray addObject:dictionary];
                }
                [mainUrls removeObjectAtIndex:0];
            }
        }
        [returnArray autorelease];
        [self performSelectorOnMainThread:@selector(_finished:) withObject:[NSArray arrayWithArray:returnArray] waitUntilDone:YES];
        }
    }
    
    -(void)_finished:(NSArray *)__array {
        NSLog(@"Result: %@", __array);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i am developing an iphone app that receive data from sql server through php
I'm developing an iPhone app. I need to create a Quiz application that has
I'm developing an iphone app, I need to create a certain size file on
I'm on developing iphone app that uses backend web service(django). To login the web
I have been developing an iPhone app which queries a server that relays data
I am new to iPhone apps developing. Just need my app to do some
We are developing an iPhone app where we need to allow users to search
I am developing a iPhone app using Monotouch. I need to access a Sqlite
I am new to iphone app developing and need to display a PDF file
I'm developing an iPhone app where I need to have some images. Particulary I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.