【发布时间】: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