Note that there are some explanatory texts on larger screens.

plurals
  1. POAFNetworking HTTP PUT Request
    primarykey
    data
    text
    <p>I have the following API call:</p> <pre><code>URL: /api/some-call Method: PUT PARAMS: No params </code></pre> <p>Its just a simple PUT method. I am trying to use AFNetworking to do that and unfortunately, I am failing. Here's what I have right now:</p> <pre><code>AFHTTPClient *httpClient = [[AFHTTPClient alloc] initWithBaseURL:url]; NSMutableURLRequest *req = [httpClient requestWithMethod:@"PUT" path:@"" parameters:nil]; AFHTTPRequestOperation *operation = [[AFHTTPRequestOperation alloc] initWithRequest:req]; [operation setCompletionBlockWithSuccess:^(AFHTTPRequestOperation *operation, id responseObject) { NSLog(@"Success"); } failure: ^(AFHTTPRequestOperation *operatn, NSError *error) { NSLog(@"Failure"); }]; NSOperationQueue *queue = [[NSOperationQueue alloc] init]; [queue addOperation:operation]; </code></pre> <p>This is however, not working. Why is that? Furthermore, what is <code>path</code> supposed to be in a <code>PUT</code> request? I've tried several things and this is what I have now at the end, which I believe <em>should</em> be close to what is correct.</p> <p>One last question: <code>AFNetworking</code> does not use <code>ARC</code>. Does that mean I still need the <code>autorelease</code> at the end of the <code>NSOperationQueue</code> statement?</p> <p><strong>EDIT:</strong> Here is error <code>NSLog</code>: <code>Failure Error Domain=com.alamofire.networking.error Code=-1011 "Expected status code in (200-299), got 409" UserInfo=0x7a91fb0 {NSErrorFailingURLKey=*the url*/api/some-call, NSLocalizedDescription=Expected status code in (200-299), got 409}</code></p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload