Ios Twitter总是被允许的
我本来希望看到一些来自iOS的提示,但总是同意的。 我的iPhone上没有帐户设置 这是否意味着我花了太多时间编程,应该出去?或者我只是错过了什么Ios Twitter总是被允许的,ios,twitter,account,Ios,Twitter,Account,我本来希望看到一些来自iOS的提示,但总是同意的。 我的iPhone上没有帐户设置 这是否意味着我花了太多时间编程,应该出去?或者我只是错过了什么 iOS 7,设备和模拟器都有相同的行为。您已经做到了。完成区块应为: - (void)authTwitter { ACAccountStore *accountStore = [[ACAccountStore alloc] init]; ACAccountType *accountType = [accountStore a
iOS 7,设备和模拟器都有相同的行为。您已经做到了。完成区块应为:
- (void)authTwitter {
ACAccountStore *accountStore = [[ACAccountStore alloc] init];
ACAccountType *accountType = [accountStore accountTypeWithAccountTypeIdentifier:ACAccountTypeIdentifierTwitter];
[accountStore requestAccessToAccountsWithType:accountType
options:nil
completion:^(BOOL granted, NSError *error){
if (granted) {
NSArray *accounts = [accountStore accountsWithAccountType:accountType];
// always there, but accounts array is empty
} else {
}
}];
对FB的类似调用不需要此值,“已授予”的值将是正确的。我假设twitter需要的特殊情况是一个iOS错误。如果删除并重新安装应用程序,它是否仍然不会提示?是的,它仍然不会提示您,您可以在没有任何错误的情况下启用对twitter帐户的访问。提示似乎只出现一次,之后用户可以在“设置”>“隐私”中更改决策。是的,我注意到在删除应用程序并再次安装->后,它以我之前设置的值出现在twitter设置上…奇怪的是,我从未允许该应用程序使用twitter帐户,所以我从来没有看到过那个应用程序的确切提示是的,我已经这样做了,所以你确认那个bug了吗?顺便说一句,在64位模拟器上,我得到了提示…提交给苹果公司。在这种情况下,我没有办法处理错误……上述情况至少允许我退出并发布一个“将twitter帐户添加到您的设备”对话框。这可以通过使用twittersdk来代替上面的方法来避免,但我还没有尝试过。此外,我还看到从requestAccessToAccountsWithType抛出的一些罕见的、不可复制的异常,因此将其包装在try/catch中。
{
bool actuallyGranted = granted;
NSArray *accounts = [accountStore accountsWithAccountType:accountType];
if (!accounts || ([accounts count] == 0))
actuallyGranted = false;
if (actuallyGranted)
{
}
else
{
}
}