Question

I would like to send POST request but without using delegate. I have to have everything in a block. I'm also didn't want to use AFNetworking for this simple task. Why? I have only one request in my app and doesn't feel like including 3-party library for this kind (i think easy) stuff.

I want to send dispatch block request at -(void)application:(UIApplication *)application performFetchWithCompletionHandler:(void (^)(UIBackgroundFetchResult))completionHandler method.

Was it helpful?

Solution

try this:

    [NSURLConnection sendAsynchronousRequest:self.request
                                       queue:[[NSOperationQueue alloc] init]
                           completionHandler:^(NSURLResponse *response, NSData *data, NSError *error) {

         if ([data length] >0 && error == nil)
         {
         }
    }];
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top