无法使用twitterkit

时间:2018-03-29 19:37:31

标签: ios login twitterkit

我正在尝试使用开发人员门户网站提供的说明使用twitterkit登录,但无济于事。 每当我尝试这样做时,无论是loginWithCompletionloginWithViewController还是TWTRLoginButton我都会在日志中收到此错误:

CredStore - performQuery - Error copying matching creds.  Error=-25300, query={
class = inet;
"m_Limit" = "m_LimitAll";
ptcl = htps;
"r_Attributes" = 1;
sdmn = "https://api.twitter.com";
srvr = "api.twitter.com";
sync = syna;
}
[TwitterKit] did encounter error with message "Error obtaining user auth token.": Error Domain=TWTRLogInErrorDomain Code=-1 "{"errors":[{"code":32,"message":"Could not authenticate you."}]}" UserInfo={NSLocalizedDescription={"errors":[{"code":32,"message":"Could not authenticate you."}]}}

这是我的plist的内容

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
...
<key>NSAppTransportSecurity</key>
<dict>
    <key>NSAllowsArbitraryLoads</key>
    <true/>
    <key>NSAllowsArbitraryLoadsInWebContent</key>
    <true/>
    <key>NSExceptionDomains</key>
    <dict>
        <key>twitter.com</key>
        <dict>
            <key>NSExceptionRequiresForwardSecrecy</key>
            <false/>
            <key>NSIncludesSubdomains</key>
            <true/>
        </dict>
    </dict>
</dict>
<key>CFBundleURLTypes</key>
<array>
    <dict>
        <key>CFBundleURLSchemes</key>
        <array>
            <string>twitterkit-XXXXXXXXX</string>
        </array>
    </dict>
</array>
<key>LSApplicationQueriesSchemes</key>
<array>
    <string>twitter</string>
    <string>twitterauth</string>
</array>
</dict>
</plist>

这是一个小型测试应用程序,我必须检查我是否在我的主应用程序中犯了任何错误,但遗憾的是我也无法登录。

我的podfile是:

source 'https://github.com/CocoaPods/Specs.git'
inhibit_all_warnings!
platform :ios, '9.0'
target 'Statkid' do
pod 'TwitterKit'
end

日志说明如下:

安装TwitterCore(3.1.0) 安装TwitterKit(3.3.0)

在我的应用设置中,我启用了Calback Locking并启用了Allow this application to sign in with twitter

如果你能帮助我,我将不胜感激。

另外,我正在部署iOS 9。

Edit:

我在consumer secret初始化Twitter时有一个额外的空间,但现在我仍然得到这个:

[TwitterKit] did encounter error with message "Error obtaining user auth token.": Error Domain=TWTRLogInErrorDomain Code=-1 "<?xml version="1.0" encoding="UTF-8"?>
<hash>
  <error>This client application's callback url has been locked</error>
  <request>/oauth/request_token</request>
</hash>
" UserInfo={NSLocalizedDescription=<?xml version="1.0" encoding="UTF-8"?>
<hash>
  <error>This client application's callback url has been locked</error>
  <request>/oauth/request_token</request>
</hash>

2 个答案:

答案 0 :(得分:9)

从2018年6月12日起,回调锁定将no longer be optional。 iOS应用程序的正确回调格式为:

twitterkit-MY_CONSUMER_KEY://

答案 1 :(得分:2)

您必须在Twitter仪表板(https://apps.twitter.com)中进行设置。请查看此屏幕截图

enter image description here