TWRequest泄露?

3

我正在使用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];
 }];

我很惊讶这个能够工作:[TWRequest release]; Leaks 告诉你哪一行代码泄漏了吗? - Tom Irving
你可以向 NSObject 的实例发送的任何消息也可以发送到一个类。[TWRequest release]; 不会做任何事情,但是“有效”。 - hypercrypt
在Xcode中运行分析,它可能会显示错误。 - zaph
1个回答

2
你需要将 [TWRequest release]; 改为 [postRequest release];

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接