以下の関数を作成しましたが、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];
}];
}
}
バックトレースによるリーク:
漏洩したオブジェクト ---- # ---- アドレス ---- サイズ ---- 責任ライブラリ ---- 責任フレーム
XPCProxy ---- 1 ---- 0x2c6480 ---- 32 バイト ---- アカウント ---- -[ACOAuthSigner initWithAccount:]
NSArray ---- 1 ---- 0x2cf010 ---- 64 バイト ---- XPCObjects ---- -[XPCProxy restrictDecodingToWhitelistedClassNames:]
Malloc 128 バイト ---- 1 ---- 0x2d0650 ---- 128 バイト ---- libdispatch.dylib dispatch_queue_create$VARIANT$mp
Malloc 128 バイト ---- 1 ---- 0x2cf0f0 ---- 128 バイト ---- libdispatch.dylib dispatch_queue_create$VARIANT$mp
ありがとうございました。