ios - How to cancel performBlock: -


i implemented search , every new character typed user performfetch: started inside of performblock:. if search string changes cancel previous started block , start over. how cancel or @ least inform block inside performblock:about it?

example code have right now:

[mymanagedobjectcontext performblock:^{         // fetch background queue         if([[self fetchedresultscontroller] performfetch:nil]) {             // update view main queue             // don't if performblock got started again! how?             [[nsoperationqueue mainqueue] addoperationwithblock:^{                 // refresh ui             }];         }     }]; 

there no api cancel performblock. once starts, continues until completes or until code returns it.

if find necessary cancel fetches while in progress, nsasynchronousfetchrequest, allows cancellation via nsprogress. async fetch requests , cancellation described in wwdc 2014 core data session


Comments

Popular posts from this blog

javascript - Slick Slider width recalculation -

jsf - PrimeFaces Datatable - What is f:facet actually doing? -

angular2 services - Angular 2 RC 4 Http post not firing -