【问题标题】:Twitter SSO always grantedTwitter SSO 始终被授予
【发布时间】:2014-04-18 18:38:42
【问题描述】:
- (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 {

            }
        }];

我期待看到来自 iOS 的一些提示,但总是同意。 我没有在我的 iPhone 上设置帐户。

这是否意味着我编程的时间太长了,应该出去玩?或者我只是错过了什么?

iOS 7,设备和模拟器都有相同的行为。

【问题讨论】:

  • 删除应用重新安装,还是没有提示吗?
  • 是的,还是没有提示
  • 显然您可以在没有任何帐户的情况下启用对 Twitter 帐户的访问。提示似乎只出现一次,稍后用户可以在“设置”>“隐私”中更改决定。
  • 是的,我注意到在删除应用程序并再次安装后 -> 它出现在 Twitter 设置中,其值是我之前设置的......
  • 奇怪的是,我从未允许该应用程序使用 twitter 帐户,所以我从未看到该应用程序的确切提示

标签: ios twitter account


【解决方案1】:

你已经在那里了。完成块应该是:

   {
   bool actuallyGranted = granted;

   NSArray *accounts = [accountStore accountsWithAccountType:accountType];
   if (!accounts || ([accounts count] == 0))
      actuallyGranted = false;

   if (actuallyGranted) 
      {

      }

   else
      {

      }
   }

对 FB 的类似调用不需要这个 - “授予”的值将是正确的。我假设 twitter 需要的特殊情况是一个 iOS 错误。

【讨论】:

  • 是的,我已经这样做了,所以你确认那个错误?顺便说一句,在模拟器 64 位上,我得到了那个提示......
  • 向 Apple 提交。在这种情况下,我没有办法处理错误......以上至少允许我保释并发布“将 twitter 帐户添加到您的设备”对话框。这可以通过使用 twitter sdk 代替上述方法来避免,但我没有尝试过。此外,我还看到了一些从 requestAccessToAccountsWithType 引发的罕见的、不可重现的异常,因此请将其包装在 try/catch 中。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2015-09-28
  • 2014-10-01
  • 1970-01-01
  • 2016-06-17
  • 1970-01-01
  • 2021-08-13
  • 2011-10-17
相关资源
最近更新 更多