我正在使用以下代码来访问用户的 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];
}
}];
我的问题是,如何在应用会话之间保存用户帐户?对于当前会话,我可以将其存储在实例变量中,但如果用户退出应用程序并返回,我如何获得该帐户?我有电话[store requestAccessToAccountsWithType:twitterAccountType...]
吗?每次?