iphone - Putting isCancelled Property in an NSOperationQueue -


this question has answer here:

so, using addoperationwithblock^{}method of nsoperationqueue , want put fine grained iscancelled property check @ points in operation code. how instance of operation run while in block?

for example, code snippet:

[operationqueueinstance addoperationwithblock:^{     if (!???.iscancelled){         nslog(@"instruction 1");     }     if (!???.iscancelled){         nslog(@"instruction 2");     }      nslog(@"instruction 3");  }]; 

how instance of operation block run in can evaluate iscancelled property instructions?

tia

from apple docs:

you should not attempt reference newly created operation object or divine type information.

you instantiate nsblockoperation , assign variable keep explicit reference instead.

addoperationwithblock seems shortcut whenever don't need reference operation object.

make sure mark block operation __block storage qualifier avoid retain cycles.


Comments

Popular posts from this blog

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -

Trying to import CSV file to a SQL Server database using asp.net and c# - can't find what I'm missing -