TestsTested | ✗ |
LangLanguage | Obj-CObjective C |
License | MIT |
ReleasedLast Release | Dec 2014 |
Maintained by Dylan Marriott.
A simple library to manage "jobs", like web requests, in a queue that can be handled asynchronously.
Often you want to perform a web request after the user has performed an action. In many cases if there's no network connection you don't want to keep the user blocked.
DMJobManager helps you queue these requests, they even get persisted, so no request will ever get lost :)
If you're not using CocoaPods you'll find the source code files inside Pod/Classes
.
To run the example project, clone the repo, and run pod install
from the Example directory first.
First, start the JobManager:
[DMJobManager startManager];
Now as soon as you have a job to be handled, just call:
[DMJobManager postJob:job];
For that a job can be handled by the JobManager it has to conform to the DMJob
-Protocol.
Basically this means it has to be serilizable (NSCoding) and implement the method executeWithCompletion:
. The completion block of the execute method has a BOOL as parameter, telling if it succeeded or not. If not successful the job will be executed again after a delay.
Take a look at DMDummyJob
and DMHTTPRequestJob
. It's pretty simple actually.
Dylan Marriott, [email protected]
DMJobManager is available under the MIT license. See the LICENSE file for more info.