AFNetworking Error Domain Code=-999 ? But works fine?

12,804

This has been answered many times before. The operation is being canceled which is why you get that error.

What to do about an NSURLErrorDomain -999?

Share:
12,804
glesage
Author by

glesage

Updated on June 04, 2022

Comments

  • glesage
    glesage almost 2 years

    I'm getting a strage error from AFNetworking even the though the request seems to work fine (as the change actually happens on the site).

    Error Domain=NSURLErrorDomain Code=-999 "The operation couldn’t be completed 
    (NSURLErrorDomain error -999.)" UserInfo=0x1fd4a080
    {NSErrorFailingURLKey=http://gcm.greenlightdispatch.com/services/json/}
    

    The strange thing is that it returns this error but it actually doesn't have a problem completing the request (on the server, the information passes through just fine and all).

    AFHTTPClient *httpClient = [[[AFHTTPClient alloc] initWithBaseURL:url] autorelease];
    [httpClient postPath:@"" parameters:[NSDictionary dictionaryWithDictionary:params]
                 success:^(AFHTTPRequestOperation *operation, id responseObject) {
    
        NSLog(@"Success: %@", [responseObject objectFromJSONData]);
    
    } failure:^(AFHTTPRequestOperation *operation, NSError *error) {
        NSLog(@"Error: %@", error.description);
    }];
    

    Thanks for the help

  • glesage
    glesage almost 11 years
    oh ok sry, I wasn't able to find that other post sorry. thanks alot!