1

I created the function below however it seems to be leaking on 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];                    


    }];
}

}

Leaks by Backtrace:

Leaked Object ---- # ---- Address ---- Size ---- Responsible Library ---- Responsible Frame

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

Thank you.

Brad Larson
  • 170,088
  • 45
  • 397
  • 571
ajayjapan
  • 349
  • 4
  • 18

1 Answers1

0

It was caused by a bug in Apple's API code on iOS 5.0, and seems to have been fixed now

Sam Clewlow
  • 4,293
  • 26
  • 36