ios - Multiple Long-Running Background Tasks -
i working on app have implemented @ least 2 background tasks. scenario becomes this, have web service tells me when start location updates user. so, need periodically call service check if it's time start, and/or stop, user's location tracking. there 2 background tasks, fetch , location tracking. fetch should run periodically defies apple's procedure monitor app's usage , decide on it's own when update content. has become first problem, there way can avoid this? second problem comes multiple tasks, how can switch between either of them? best practice here? dos , don'ts?
you should use push notifications through apple's push servers, or may find service parse.com easier work with. can use push notification trigger or create in app delegate (where handle receiving push notifications). @paulw11 's comment states, can attach payload(data) push notification , deal it. first part fire notification user's device when should start tracking , end tracking.
most location tracking stuff using instance of cllocationmanager can done via it's delegate methods. if want can use in subclass of nsoperation , manage in nsoperationqueue, see here tutorial:
http://www.raywenderlich.com/76341/use-nsoperation-nsoperationqueue-swift
and suggest researching class documentation.
Comments
Post a Comment