我有下面的代码,当我执行请求时,它总是让我崩溃,你知道吗?
NSString *responseBody = [[NSString alloc] initWithData:data
encoding:NSUTF8StringEncoding];
NSLog(@"Response body is %@", responseBody);
NSDictionary *accessTokenRequestParams = [[NSMutableDictionary alloc] init];
[accessTokenRequestParams setValue:CONSUMER_KEY forKey:@"x_reverse_auth_target"];
[accessTokenRequestParams setValue:responseBody forKey:@"x_reverse_auth_parameters"];
NSURL *url2 = [NSURL URLWithString:@"https://api.twitter.com/oauth/access_token"];
TWRequest * accessTokenRequest = [[TWRequest alloc] initWithURL:url2 parameters:accessTokenRequestParams requestMethod:TWRequestMethodPOST];
if (selectionIndex != -1)
[accessTokenRequest setAccount:[self.twitterACAccounts objectAtIndex:selectionIndex]];
// execute the request
[accessTokenRequest performRequestWithHandler:
^(NSData *responseData, NSHTTPURLResponse *urlResponse, NSError *error) {
NSString *responseStr =
[[NSString alloc] initWithData:responseData
encoding:NSUTF8StringEncoding];
NSLog(@"The user's info for your server:\n%@", responseStr);
}];更新:打开NSZombieEnabled可以让我
*** -[ACAccountStore typeForAccount:]: message sent to deallocated instance 0x7199c70这是找不到的地方
发布于 2012-01-10 04:52:49
您的错误看起来与您的问题完全不同。您在ACAccountStore类中有错误。在访问、操作和存储帐户(ACAccountStore)时,请检查您的保留计数。我认为你首先被释放了内存,并且你正在使用一些地方。
发布于 2012-01-10 04:48:58
一个叫ACAccountStore typeForAccount的地方。但ACAccountStore已不复存在。查看AcAccount文档,没有特殊的初始化器,所以在您的代码中可能会有如下内容:
static ACAccountStore* accountStore = [[[ACAccountStore alloc] init] autorelease];然后,在完成请求时,对象已被操作系统清除,但您的accountStore仍然指向旧的、现在悬空的指针。指针可以是' static‘或' global’,或者是某个其他静态或全局对象的成员。
在您的代码中查找ACAccountStore。
https://stackoverflow.com/questions/8793588
复制相似问题