- (void)someMethodThatIsCalledTwice{
NSURLSession *session = [NSURLSession sharedSession];
NSString *noteDataString = [NSString stringWithFormat:@"album_id=%@&pic_id=%@", albumId,photoId];
NSURL *url = [NSURL URLWithString:stringUrl];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url];
NSLog(@"PARAMS: %@", noteDataString);
request.HTTPBody = [noteDataString dataUsingEncoding:NSUTF8StringEncoding];
request.HTTPMethod = @"POST";
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
}];
}
This problem is that if I call this method twice passing different request.HTTPBody the dataTask gets the the noteDataString from the second call for both first and second call.