gpt4 book ai didi

objective-c - 将现有 OAuth 凭据迁移到 ACAccountStore 时出错

转载 作者:行者123 更新时间:2023-11-29 04:56:48 24 4
gpt4 key购买 nike

我在将现有 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

最佳答案

此错误消息是由于使用不正确的 token / secret 组合引起的。我错误地从 OAuth token 中删除了 user_id 前缀。

关于objective-c - 将现有 OAuth 凭据迁移到 ACAccountStore 时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7800675/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com