3 ms·
> I just finished implementing an iOS app that uses a background operations queue for network operations. As someone who has never developed for mobile, is tha
by kbenson 9y ago
> I just finished implementing an iOS app that uses a background operations queue for network operations.
As someone who has never developed for mobile, is that OS provided, or something you had to implement yourself? It seems like something like that (at least for HTTP) should be included, and with some rich controls to toggle whether jobs should persist app closes and restarts, or jobs should wait for wireless or are okay on cellular, whether jobs of type X should replace other jobs of type X (no reason for 5 queued requests for latest updates to the same feed to all fire when conditions are right...), etc.
- saagarjha 9y agoThis is part of the OS.
- matwood 9y agoNative iOS/MacOS provide a rich set of libraries around multi-threaded/background processing. Look up Grand Central Dispatch (GCD). https://en.wikipedia.org/wiki/Grand_Central_Dispatch https://en.wikipedia.org/wiki/Grand_Central_Dispatch
- potatolicious 9y agoiOS doesn't provide any high-level network constructs of this sort out of the box. There are lots of classes to help with setting up and tearing down network connections, and convenience classes for standard things like encoding/decoding, parsing, etc, but complex task management is entirely up to the developer. Operation Queues[1] do provide some of this functionality in a non-network-specific context and can handle priority/concurrency/dependencies between multiple tasks, but it's still up to the developer to layer any network activity on top of it. Things like limiting some connections to cell/wifi, job persistence between app instances, and job deduplication, are entirely in the dev's hands - though the system does provide all the necessary APIs to implement all of the above. A caveat though - the OS itself imposes some concurrency (max concurrent network connections for a single app) limits in an opaque way for the purposes of throttling, but the developer doesn't really have access to this. [1] https://developer.apple.com/reference/foundation/operationqueue https://developer.apple.com/reference/foundation/operationqu...
- hornetblack 9y agoI think Intent services do this on Android. I'm not sure as I am new to it.