我有一种方法允许用户使用 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
// ......
})
}