I've been using the SimplePost classes for several weeks and haven't had any problems. Now I'm crashing after a Request returns proper data in a Connection. I haven't (knowingly) touched the SimplePost class files. But when I run the analyzer, it now (never did before) points out the following method:
+ (NSMutableURLRequest *) urlencodedRequestWithURL:(NSURL *)url andDataDictionary:(NSDictionary *) dictionary {
// Create POST request
NSMutableURLRequest *urlencodedPostRequest = [NSMutableURLRequest requestWithURL:url];
[urlencodedPostRequest setHTTPMethod:@"POST"];
// Add HTTP header info
[urlencodedPostRequest addValue:@"application/x-www-form-urlencoded" forHTTPHeaderField: @"Content-Type"];
// Add POST body
NSMutableData *POSTBody = [NSMutableData data];
// Add k/v to the body
NSArray *keyArray = [dictionary allKeys];
for( int i = 0; i < [keyArray count]; ++i ) {
// Core Foundation function used to transform @ ==> %40 , etc
NSString *escapedString = (__bridge NSString *) CFURLCreateStringByAddingPercentEscapes(NULL, (__bridge CFStringRef)([dictionary objectForKey:[keyArray objectAtIndex:i]]),NULL, (CFStringRef)@"!*'();:@&=+$,/?%#[]", kCFStringEncodingUTF8);
[POSTBody appendData:[[NSString stringWithFormat:@"%@=%@", [keyArray objectAtIndex:i], escapedString] dataUsingEncoding:NSUTF8StringEncoding]];
if( i < ([keyArray count] - 1) ) {
[POSTBody appendData:[[NSString stringWithFormat:@"&"] dataUsingEncoding:NSUTF8StringEncoding]];
}
}
[urlencodedPostRequest setHTTPBody:POSTBody];
return urlencodedPostRequest;
}
And running the Analyzer shows me:
the lines continue as:
I'm having a hard time understanding what's happening. Can anyone help, please? Thanks!