1
iOS6。我在设置应用中登录了Twitter。accountsWithAccountType返回空数组
我关闭了我的应用程序,然后“设置”应用程序重新运行。
ACAccountStore *store = [[ACAccountStore alloc] init];
ACAccountType *accountType = [store accountTypeWithAccountTypeIdentifier:ACAccountTypeIdentifierTwitter];
[self createAccountPickerForAccountType:accountType withStore:store];
...
- (void)createAccountPickerForAccountType:(ACAccountType *)accountType withStore:
self.accounts = [store accountsWithAccountType:accountType];
[self displayAccountPicker];
数组返回是一个空数组。
更新:?想通了你!必须要求权限(并授予它们)才能使用计数。要请求权限,请使用[ACAccountStore requestAccessToAccountsWithType] –