这是我的代码
TWRequest *twRequest = [[TWRequest alloc] initWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"%@%@", kTwitterURLBase, kTwitterMethodHelpConfiguration]]
parameters:nil
requestMethod:TWRequestMethodGET];
[twRequest setAccount:[self twitterAccount]];
[twRequest performRequestWithHandler:^(NSData *responseData, NSHTTPURLResponse *urlResponse, NSError *error) {
// Handling
}];
方法twitterAccount
- (ACAccount *)twitterAccount {
NSString *identifier = [[Session getInstance] selectedAccountIdentifier];
ACAccount *account = nil;
if ([identifier length] > 0) {
ACAccountStore *accountStore = [[ACAccountStore alloc] init];
account = [accountStore accountWithIdentifier:identifier];
}
return account;
}
正如调试器所说,该帐户已正确返回,但是当我在控制台中打印它时,我什么也没得到,一个空格;但是帐户对象有一个引用。
就在请求开始执行后,我收到一个 EXC_BAD_ACCESS 错误。堆栈说发送错误消息时发生错误[ACAccount accountType]
。
很明显这是一个内存问题,而且我是 ARC 的新手,所以我想问题会在那里。
有什么帮助吗?