Wednesday, 15 August 2012

How to create an asynchronous NSoperation iOS? -


I have studied the document about Apple asynchronous operation and I am unable to get it right.

I am doing my understanding and efforts to share please take a look and suggest me to understand asynchronous NSOperation properly.

Asynchronous is a read-only asset and we can not change it. I have created a class that receives NS operations, I have started the override and also the main method.

I am not using NSOperationQueue When I start operations using [start operation]; To start the method again on the main thread and in the main method implementation, I have isynchronous '0'.

When I launched using secondary thread

  dispatch_async (dispatch_get_global_queue (DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^ {Operation = [[CustomOperation alloc] init]; [operation Start];}  

Why do I start getting still the main method of implementation isAsynchronous '0'

I do. I have not found asynchronous always any thread Please give me the reason behind this.

I saw that some questions were asked based on this problem but I Ryashilta could not understand. / P>

If you give me would be helpful for my then give any example so I can understand it properly.

Please let me know what I do not have enough and I should make it a more complete description.

If you are found to Grand Central Dispatch and Ansopreshn.

By default, an NSOperation is synchronous - when you start it, I am on the current thread Lne the T is not finished you are starting a synchronous Ansopreshn on a background thread, so it will run on a background thread until it will not end. Which of course is not a problem that runs in the background, it does not say to yourself "asynchronous" because it does not care about threads

Most of the time when you use Grand Central Dispatch and Nor use the NSOction, at which point you use NS operations, when it is required to be canceled.


No comments:

Post a Comment