我正在尝试访问 Twitter 帐户,但此代码在 accountTypeWithAccountTypeIdentifier 行停止。
我的代码看起来像这样,我运行的是 iOS 6:
#import <Accounts/Accounts.h>
#import <Social/Social.h>
#import <Twitter/Twitter.h>
NSLog(@"1");
ACAccountStore *accountStore = [[ACAccountStore alloc] init];
NSLog(@"2");
ACAccountType *accountType = [accountStore accountTypeWithAccountTypeIdentifier:ACAccountTypeIdentifierTwitter];
NSLog(@"3");
[accountStore requestAccessToAccountsWithType:accountType options:nil completion:^(BOOL granted, NSError *error) {
NSLog(@"5");
}];
NSLog(@"4");
我得到 NSLogs 1 和 2,这意味着 accountTypeWithAccountTypeIdentifier 行没有返回。我已经尝试在主线程和后台线程中运行它,但无济于事。
最佳答案
您很可能忘记将 Accounts.framework 添加到您的项目中。 (这为我解决了同样的问题)
关于iphone - accountTypeWithAccountTypeIdentifier 未完成,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18232677/