我创建了下面的函数,但它似乎在performRequestWithHandler上泄漏。
- (void)getDataForRequest:(TWRequest *)postRequest withSelector:(SEL)selector {
if (twitterAccount != nil) {
[postRequest setAccount:twitterAccount];
[postRequest performRequestWithHandler:^(NSData *responseData, NSHTTPURLResponse *urlResponse, NSError *error){
id jsonResponse = nil;
if (responseData) {
NSError *jsonParsingError = nil;
jsonResponse = [NSJSONSerialization JSONObjectWithData:responseData options:0 error:&jsonParsingError];
}
if (!jsonResponse) {
NSString *responseString = [[NSString alloc] initWithData:responseData encoding:NSASCIIStringEncoding];
jsonResponse = [NSDictionary dictionaryWithObjectsAndKeys:responseString, @"response", nil];
}
if (error != nil && ![jsonResponse objectForKey:@"error"]) {
NSString *errorMessage = error.localizedDescription;
jsonResponse = [NSDictionary dictionaryWithObjectsAndKeys:errorMessage, @"error", nil];
}
[self performSelectorOnMainThread:selector withObject:jsonResponse waitUntilDone:NO];
}];
}
}
Backtrace泄漏:
泄露对象----#----地址----大小----负责任的图书馆----负责任的框架
XPCProxy ---- 1 ---- 0x2c6480 ---- 32 Bytes ---- Accounts ---- - [ACOAuthSigner initWithAccount:]
NSArray ---- 1 ---- 0x2cf010 ---- 64 Bytes ---- XPCObjects ---- - [XPCProxy restrictDecodingToWhitelistedClassNames:]
Malloc 128 Bytes ---- 1 ---- 0x2d0650 ---- 128 Bytes ---- libdispatch.dylib dispatch_queue_create $ VARIANT $ mp
Malloc 128 Bytes ---- 1 ---- 0x2cf0f0 ---- 128 Bytes ---- libdispatch.dylib dispatch_queue_create $ VARIANT $ mp
谢谢。
答案 0 :(得分:0)
这是由iOS 5.0上的Apple API代码中的一个错误引起的,现在似乎已经修复了