ios - Using GCD for offline persistent queue -


right have older code wrote years ago allows ios app queue jobs (sending messages or submitting data back-end server, etc...) when user offline. when user comes online tasks run. if app goes background or terminated queue serialized , loaded when app launched again. i've subclassed nsoperationqueue , jobs subclasses of nsoperation. gives me flexibility of having data structure provided me can subclass directly (the operation queue) , subclassing nsoperation can requeue if task fails (server down, etc...).

i leave is, because if it's not broke don't fix it, right? these lightweight operations , don't expect in current app i'm working on there many tasks queued @ given time. know there overhead using nsoperation rather using gcd directly.

i don't believe subclass dispatch queue way can nsoperationqueue, there code overheard me maintain own data structure , load & out of dispatch queue each time app sent background, right? not sure how i'd handle requeueing job if fails. right if 500 server, example, in operation code send notification deep copy of failed nsoperation object. custom operation queue picks notification , adds task itself. not sure how of if i'd able similar gcd. need easy way cancel operations or suspend queue when network connectivity lost reactivate when network access regained.

just hoping thoughts, opinions , ideas others might have done similar or more familiar gcd am.

also worth noting know there's new background task support coming in ios 7 while before deployment target. not sure yet if need, @ moment looking @ possibility of gcd.

thanks.

if nsoperation vs submitting blocks gcd ever shows measurable overhead, problem isn't you're using nsoperation, it's operations far granular. expect overhead unmeasurable in real-world situation. (sure, contrive test harness measure overhead, making operations did nothing.)

use highest level of abstraction gets job done. move down when hard data tells you should.


Comments

Popular posts from this blog

matlab - Deleting rows with specific rules -

php - MySQLi multi_query results for later use -