【发布时间】:2014-01-14 18:14:59
【问题描述】:
为什么下面的代码 works fine in ios6 和 not in ios7 ?我错过了ios 7的东西吗
ACAccountStore *account_Store = [[ACAccountStore alloc] init];
ACAccountType *account_Type = [account_Store accountTypeWithAccountTypeIdentifier:ACAccountTypeIdentifierTwitter];
arrayOfAccounts = [[NSMutableArray alloc]initWithArray:[account_Store accountsWithAccountType:account_Type]];
NSLog(@"arrayOfAccounts %@",arrayOfAccounts);
if ([arrayOfAccounts count] > 0)
{
ACAccount *acct1;
array = [[NSMutableArray alloc]init];
for (int i = 0 ; i < [arrayOfAccounts count]; i++ )
{
acct1 = [[ACAccount alloc]init];
acct1 = [arrayOfAccounts objectAtIndex:i];
[array setObject:[NSString stringWithFormat:@"%@",acct1.username] atIndexedSubscript:i];
// NSString *username = acct1.username;
// NSLog(@"user at index %d : username %@",i,username);
}
}
Debug 区域中的这条语句NSLog(@"arrayOfAccounts %@",arrayOfAccounts); 给出了输出:
arrayOfAccounts ( )
【问题讨论】:
-
这是在模拟器还是手机上?您是否在 iOS 7 模拟器上设置了 Twitter 帐户?
-
是的,我已经在模拟器和设备上进行了测试,并且我也从设置中设置了 twitter 帐户