【问题标题】:ACAccountStore no longer work with Twitter? (Swift, iOS 12)ACAccountStore 不再适用于 Twitter? (斯威夫特,iOS 12)
【发布时间】:2019-09-17 03:02:12
【问题描述】:

我有一个方法允许用户使用 twitter API 关注其他 twitter 帐户,但是,自 iOS 11 以来,此方法停止工作。

因为: 社交帐户已从 iOS 11 的“设置”中删除。第三方应用程序不再有权访问这些已登录的帐户。 (31687059)

(在下面的方法中,返回值“isGranted”为false,错误码为:error 7, from apple.com)

有没有办法解决这个问题?

static func followAppTwitter(_ twitterScreenName: String) {

    let accountStore = ACAccountStore()
    let twitterType = accountStore.accountType(withAccountTypeIdentifier: ACAccountTypeIdentifierTwitter)

    accountStore.requestAccessToAccounts(with: twitterType, options: nil,
        completion: { (isGranted, error) in
            guard let userAccounts = accountStore.accounts(with: twitterType),
                userAccounts.count > 0 else { return }
            guard let firstActiveTwitterAccount = userAccounts[0] as? ACAccount else { return }

            // Then do a data post to twitter API
            // ......
    })
}

【问题讨论】:

  • 我也在努力寻找一个好的替代品。你最终找到了一个不错的解决方案吗?
  • @MichaelRowe 啊我没有。如果你找到了,请告诉我。
  • @MichaelRowe 你找到解决方案了吗?
  • 我切换到 SwifteriOS 似乎对我来说工作正常...我现在将凭据存储在我的应用程序空间中...

标签: ios swift twitter twitter-oauth acaccountstore


【解决方案1】:

搜索了一段时间后 - 我已将我的代码替换为 - https://github.com/mattdonnelly/Swifter SwifterIOS

【讨论】:

  • Objective-C 有什么类似或等价的吗? ?
  • 我有一段时间没看目标c了。
猜你喜欢
  • 1970-01-01
  • 2023-03-17
  • 1970-01-01
  • 2017-07-22
  • 2017-03-24
  • 2016-11-23
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多