I'm using AFNetworking to run a PHP script as shown below:
NSString *urlString = @"scriptURL.php";
AFHTTPRequestOperationManager *manager = [AFHTTPRequestOperationManager manager];
[manager POST:urlString parameters:params constructingBodyWithBlock:^(id<AFMultipartFormData> formData) {
...
} success:^(AFHTTPRequestOperation *operation, NSDictionary *responseObject) {
NSLog(@"it worked!");
} failure:^(AFHTTPRequestOperation *operation, NSError *error) {
NSLog(@"error: %@", error.description);
}];
However, there are parts of the script that take longer to run (sending a bunch of push notifications). Currently, this means that I do not receive a response object until after all of the pushes have been sent, causing a significant delay. Is there a way to force the return of the response object so that the longer, more time-consuming actions can run in the background? In other words, can I force a return of a response object such that it returns before I begin sending the push notifications, so that the iOS side does not need get stalled in waiting for the other actions to finish