在将现有OAuth凭据迁移到iOS 5中的ACAccountStore时遇到问题。
ACAccountStore *accountStore = [[ACAccountStore alloc] init];
ACAccountType *accountType = [accountStore accountTypeWithAccountTypeIdentifier:ACAccountTypeIdentifierTwitter];
ACAccount *account = [[ACAccount alloc] initWithAccountType:accountType];
ACAccountCredential *credential = [[ACAccountCredential alloc] initWithOAuthToken:savedToken tokenSecret:savedSecret];
[account setCredential:credential];
[accountStore saveAccount:account withCompletionHandler:^(BOOL success, NSError *error) {
if (error) {
NSLog(@"error saving account: %@", error.description);
}
NSLog(@"saved account? %d", success);
}];最终结果是:
2011-10-17 19:09:32.927 League[13731:1b803] error saving account: Error Domain=NSURLErrorDomain Code=-1012 "The operation couldn’t be completed. (NSURLErrorDomain error -1012.)"
2011-10-17 19:09:32.927 League[13731:1b803] saved account? 0发布于 2011-10-19 03:55:58
此错误消息是由使用不正确的令牌/密钥组合导致的。我错误地删除了OAuth标记的user_id前缀。
https://stackoverflow.com/questions/7800675
复制相似问题