AFNetworking/AFNetworking — Issue #193: Memory related crash on httpclient multipart form request
Author: wcrtr
Created: 2012-01-26 22:01:02+00:00
State: open

Hi,

Hopefully this is the appropriate place to file this, or to attempt and get some help...

Not sure if it's a bug or just something messed up with the way I'm handling memory.

my code (where RRRAPIClient is a subclass of AFHTTPClient):

NSMutableURLRequest *vrequest = [[RRRAPIClient sharedClient] multipartFormRequestWithMethod:@"POST" path:@"/my_path" parameters:params constructingBodyWithBlock:^(id formData) {
}];

AFJSONRequestOperation *operation = [AFJSONRequestOperation operationWithRequest:vrequest success:^(id JSON) {
NSLog(@"results from server %@", JSON);

} failure:^(NSHTTPURLResponse *response, NSError *error) {
NSLog(@"failed: %@", [error localizedDescription]);
[hud hide:YES];
}];

[operation start];

The problem I'm having is that this works the first time I run it, then crashes with an exc_bad_access error the next time I call it. I'm working in an ARC project, and my guess is something funky is happening with the reference counting? Any thoughts?

Again, not sure if this is a bug in the code, or just operator error...

Thanks for any insight!