首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >将现有OAuth凭据迁移到ACAccountStore时出错

将现有OAuth凭据迁移到ACAccountStore时出错
EN

Stack Overflow用户
提问于 2011-10-18 07:10:23
回答 1查看 1.4K关注 0票数 0

在将现有OAuth凭据迁移到iOS 5中的ACAccountStore时遇到问题。

代码语言:javascript
复制
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);
}];

最终结果是:

代码语言:javascript
复制
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
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2011-10-19 03:55:58

此错误消息是由使用不正确的令牌/密钥组合导致的。我错误地删除了OAuth标记的user_id前缀。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/7800675

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档