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 return
s 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
Post a Comment