Using Grand Central Dispatch on iOS, what queue (if any) do regular Objective-C blocks run on if they are not in a dispatch queue? -
Do the options # 1 run some sort of inherent queue below? It does not seem to run on the main line, because when I tried updating the AI content, I complained, till I did not run in option # 3, I believe the blocks have their own queue or thread is? Before complaining, I was under the assumption that if I did not start a dispatch queue that things would run like normal, which would be in the main line in my mind, for example examples of example:
// user view controller. @ Interface user view controller: NSObject @property (nonatomic, strong) server * server; @protecti (non-standard, strong) user * user; @end // UserViewController.m - The controller that sets a block to be used in the other category @UfLuleUserUser controller - (zero) doSomething {// I want to call other methods and set the property @ from the controller and I have heard / / __weak is the right keyword to use (rather than __block or __strong). __weak UserViewController * Vulnerable Controller = Self; // Option # 0 - controller outside the block weakening. User = [[RHJUSAR Alok] Init]; Server.callbackBlock = ^ (NSURLResponse * response, NSData * data, NSError * error) {// Option # 1 - Is it in some sort of default queue outside the send queue? WeakController.user = [[RHAGUSAR Alok] Init]; Dispatch_queue_t background Queue = dispatch_queue_create ("com.example.backgroundQueue", null); Sender_Associate (background que, ^ {// option # 2 - this is in serial queue which I have weakened Controller User. [[RHZ User Alloc] init]; Dispatch_Assic (Dispatch_Get_man_QE), ^ {// Option # 3 - Main Queue All my UI is weak controller User = [[[RHJJASArAlok] Init];} // Dispatch_Asslicator} // Dispatch_Association}; // Speak Block Lock; @ and // serverM - A version using block defined in controller @ Implementation Server - makeAServerCall {[NSURLConnection sendAsynchronousRequest: [NSMutableURLRequest requestWithURL: restServiceURL] Queue: [[NSOperationQueue alloc] init] completionHandler: self.callbackBlock];} @end
Comments
Post a Comment