我在ios5中使用TWRequest,但Leaks报告了TWRequest的内存泄漏。
我正在做这样的事情,我在某个地方出错了?
TWRequest *postRequest = [[TWRequest alloc] initWithURL:[NSURL URLWithString:@"http://api.twitter.com/1/friendships/create.json"] parameters:[NSDictionary dictionaryWithObject:@"auser" forKey:@"screen_name"] requestMethod:TWRequestMethodPOST];
// Set the account used to post the tweet.
[postRequest setAccount:twitterAccount];
// Perform the request created above and create a handler block to handle the response.
[postRequest performRequestWithHandler:^(NSData *responseData, NSHTTPURLResponse *urlResponse, NSError *error) {
NSString *output = [NSString stringWithFormat:@"HTTP response status: %i", [urlResponse statusCode]];
[TWRequest release];
}];
答案 0 :(得分:2)
您需要将[TWRequest release];
更改为[postRequest release];