我正在使用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];
}];
NSObject
的实例发送的任何消息也可以发送到一个类。[TWRequest release];
不会做任何事情,但是“有效”。 - hypercrypt