iphone - NSOperation for drawing UI while parsing data? -


Hope you guys can help me :)

In the main thread, I have a NS operation I am in a queue that this operation connects to the data server with the NSRR connection, saves the data received and parses it.

Operation.M

  - (zero) start {NSLog (@ "operaion for and left;% @ activation"), [CMD Description]); [Will Will Changewellfall: @ "Exerting"]; _isExecuting = yes; [AUTO KEYCHENGEVALFORICI: @ "Expreting"]; NSMutableURLRequest * Request = [NSMutableURL request url with url: _url]; [Set http system: @ "post"]; [Request Set Value: [NSString stringWithFormat: @ "Multipart / Form-Data; limit =% @", MBO and more] forHTTPHeaderField: @ "Content-Type"]; [Request set http: bb: _page]; _connection = [[NSUK connection alloc] InitvuthRequest: Request Rep: Auto]; If (_connection == zero) [self finishes]; }  

Then in this NSURL delegation method I parse the data I just received from the server.

Operation.m

- (zero) connectionDifffish: Loading: (NSUrCon Connection *) Connection {[Self Pars Itims]; }

In the data, for example, I can get items such as screenittum, cellitum, textitem, which I send to portray them during the main thread.

Using this to send the item to the main thread:

Operation.M

/ Strong >

[Auto_readScreen]] break;; case cell: {[auto_seed: [auto_readcell]]; breakdown; // ... many different items}}} - (zero) _send: (citem *) _ Item {[NSNation Centers Default Center] PostNotificationName: @ "New Eatam" Object: _Item];}

then in the notification receiver:

AppDelegate.m

  - (zero) _newItemArrived: (nsnification *) notification { Self-demonstration detectorOnMineTrade: @Sylector (Process Input :) with Object: [Notification Object] WaitingTone: No];}  

My problem is that the UI has not been portrayed until the end of the noopartition I thought that NSOPRIATION would not block the main thread having a different thread, but Wish Believe what is happening.

Some suggestions for this issue?

Thanks a lot for reading!

Are you using NSOperationQueue ?

Check Questions for a simple example of how to update the UI with information from asynchronous running NS operations on any other thread. > NSURL connection supports asynchronous connection with itself with a delegate. You should use it if you have specific problems, you should describe them.

  • Check the library.
  • If you really want to use this approach, you can try running NSURLConnection synchronously, class method). The connection is on a background thread because your app will remain liable though, you will not be able to update anything until you receive all the data.

  • Comments

    Popular posts from this blog

    oracle - The fastest way to check if some records in a database table? -

    php - multilevel menu with multilevel array -

    jQuery UI: Datepicker month format -