Note that there are some explanatory texts on larger screens.

plurals
  1. POA bit help for using queuing and Grand Central Dispatch on iOS
    primarykey
    data
    text
    <p>This is my problem, I'm building an iOS with some JSON returs from my server, here, no problems, all works fine.</p> <p>The problem is that when I run the program, it take a long long time to parse the result into a <code>NSMutableArray</code>: this is the log</p> <pre><code>2013-01-10 12:03:48.627 project[5917:907] &lt;- time begin parser 2013-01-10 12:03:48.755 project[5917:907] &lt;- time finish parser 2013-01-10 12:03:48.756 project[5917:907] &lt;- time begin implement arrays 2013-01-10 12:03:58.522 project[5917:907] &lt;- time finish implement array </code></pre> <p>As you can see, implementing the arrays is <strong>really</strong> long.</p> <p>I know that I have to use queueing and grand central dispatch to make my UI responsive, but I don't know how to, could you please help me to do that ?</p> <p>This is my <code>viewDidLoad</code> Method</p> <pre class="lang-objc prettyprint-override"><code>- (void)viewDidLoad { [super viewDidLoad]; if debug NSLog(@"&lt;- time begin parser"); endif NSString *URLStr = @"http://myJsonFile.json"; NSDictionary *myDictwithReturn = [TOCJSONParser awesomeParserWithStringOfYourJSONFile:URLStr]; //really cool parser, i can put it on gitHub if you want NSArray *speakersArray = [myDictwithReturn objectForKey:@"speakers"]; myArray = [[NSMutableArray alloc]init]; NSLog(@"&lt;- time finish parser"); NSLog(@"&lt;- time begin implement arrays"); for (NSDictionary *myDict in speakersArray) { _nextSpeaker = [[TOCSpk alloc]init]; [_nextSpeaker setName:[myDict objectForKey:@"name"]]; [_nextSpeaker setBusiness:[myDict objectForKey:@"business"]]; [_nextSpeaker setDesc:[myDict objectForKey:@"desc"]]; [_nextSpeaker setTwitter:[NSURL URLWithString:[myDict objectForKey:@"twitter"]]]; [_nextSpeaker setPicture:[_nextSpeaker retrieveImageFromServer:[myDict objectForKey:@"picture"]]]; [myArray addObject:_nextSpeaker]; } NSLog(@"&lt;- time finish implement array"); } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload