将现有OAuth凭据迁移到ACAccountStore时出错 [英] Error migrating existing OAuth credentials to ACAccountStore

查看:116
本文介绍了将现有OAuth凭据迁移到ACAccountStore时出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I'm having problems migrating existing OAuth credentials to ACAccountStore in iOS 5.

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


推荐答案

此错误消息是由使用不正确的令牌引起的/秘密组合。我错误地修改了OAuth令牌的user_id前缀。

This error message is caused by using an incorrect token/secret combination. I was incorrectly trimming the user_id prefix off of the OAuth token.

这篇关于将现有OAuth凭据迁移到ACAccountStore时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆