ACAccountStore不再与Twitter配合使用?(Swift,iOS 12)

3

我有一个可以使用Twitter API让用户关注其他Twitter账户的方法,但是该方法自从后就无法正常工作了。

原因是:社交账户从的设置中删除了。第三方应用程序不再能够访问这些已登录的帐户。(31687059)

(在以下方法中,返回值"isGranted"将为false,并且错误代码将为:来自apple.com的错误7)

是否有一种方法可以解决这个问题?

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
            // ......
    })
}

我也在尝试寻找一个好的替代方案.. 你最终找到了一个不错的解决方案吗? - Michael Rowe
1
@MichaelRowe 啊,我没有找到。如果你找到了,请告诉我。 - RainCast
@MichaelRowe 你找到解决方案了吗? - RainCast
1
我转到了SwifteriOS,对我来说似乎运作正常...我现在将认证凭据存储在我的应用空间中... - Michael Rowe
1个回答

1

有没有类似或等效于Objective-C的东西? - Erika Electra
我已经有一段时间没有看Objective-C了。 - Michael Rowe

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接