1

我创建了下面的函数,但是它似乎在 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 字节 ---- Accounts ---- -[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

谢谢你。

4

1 回答 1

0

它是由 iOS 5.0 上 Apple 的 API 代码中的错误引起的,现在似乎已修复

于 2012-07-04T13:11:35.097 回答