Offline support for HTTP requests (POST
/PUT
/PATCH
/DELETE
). If the request fails, times out or if you're offline you can save the task on disk and reproduce it later.
Saving failed requests:
[task saveWithParams:params];
[manager POST:path
parameters:params
success:^(NSURLSessionDataTask *task, id responseObject) {
// everything went well, be happy
} failure:^(NSURLSessionDataTask *task, NSError *error) {
[task saveWithParams:params];
}];
Retrieving offline requests:
NSArray *offlineTasks = [NSURLSessionTask offlineTasks];
Removing offline requests:
[task remove];
Replaying offline requests (needs a NSURLSession
or a AFHTTPSessionManager
):
[manager replay];
Elvis Nuñez, [email protected]
NSURLSessionTask-ANDYOffline is available under the MIT license. See the LICENSE file for more info.