sendSynchronousRequest
是不是造成了下面的泄漏?文书指出,责任框架是
NSURLConnection
它指向一个
NSCFString
在管道中泄漏
发送同步请求
我已经读到,这是一个已知的问题,在操作系统2.2或其他东西,但现在肯定应该得到修复。有什么想法吗?
[UIApplication sharedApplication].networkActivityIndicatorVisible = YES;
NSURL *url = [NSURL URLWithString:@"http://www.mysite.com/api/v1/dosomething"];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url cachePolicy:NSURLRequestReloadIgnoringCacheData timeoutInterval:20.0];
[request setHTTPMethod:@"POST"];
NSData *bodyData;
[request setValue:@"text/plain" forHTTPHeaderField:@"Content-Type"];
NSString *body = @"test";
bodyData = [body dataUsingEncoding:NSUTF8StringEncoding];
[request setHTTPBody:bodyData];
[body release];
[[NSURLCache sharedURLCache] setMemoryCapacity:0];
[[NSURLCache sharedURLCache] setDiskCapacity:0];
NSHTTPURLResponse *response = nil;
NSError *error = nil;
NSData *responseData = [NSURLConnection sendSynchronousRequest:request returningResponse:&response error:&error];
NSString *responseString = [[NSString alloc]initWithData:responseData encoding:NSUTF8StringEncoding];