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

php - cannot display multiple markers in google maps v3 from traceroute result -

php - Boolean search on database with 5 million rows, very slow -

css - Text drops down with smaller window -