gpt4 book ai didi

objective-c - 在 iOS 5 中保存 Twitter 帐户?

转载 作者:可可西里 更新时间:2023-11-01 05:42:13 25 4
gpt4 key购买 nike

我正在使用以下代码来访问用户的 Twitter 帐户:

ACAccountStore *store = [[ACAccountStore alloc] init];
ACAccountType *twitterAccountType =
[store accountTypeWithAccountTypeIdentifier:ACAccountTypeIdentifierTwitter];

// Request access from the user for access to his Twitter accounts
[store requestAccessToAccountsWithType:twitterAccountType
withCompletionHandler:^(BOOL granted, NSError *error) {
if (!granted) {
NSLog(@"User rejected access to his account.");
}
else {
NSArray *arrayOfAccounts = [store accountsWithAccountType:twitterAccountType];
if ([arrayOfAccounts count] > 0) {
ACAccount *acct = [arrayOfAccounts objectAtIndex:0];
}
}];

我的问题是,如何在应用 session 之间保存用户帐户?对于当前 session ,我可以将它存储在一个实例变量中,但是如果用户退出应用程序并返回,我如何获得该帐户?我是否已调用 [store requestAccessToAccountsWithType:twitterAccountType...]?每次?

最佳答案

您可以保存 TWAccount.identifier,然后使用 [ACAccountStore accountWithIdentifier] 稍后检索同一帐户。

关于objective-c - 在 iOS 5 中保存 Twitter 帐户?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10777406/

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