首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >TwitterKit 3.0.3授权失败

TwitterKit 3.0.3授权失败
EN

Stack Overflow用户
提问于 2017-07-07 11:50:15
回答 1查看 2.6K关注 0票数 2

我用推特上的官方指南登录

我的脚步:

  1. 回调URL在应用程序管理中保留空白字段
  2. 安装吊舱pod 'Fabric'pod 'TwitterKit'
  3. 添加Info.plist

CFBundleURLTypes CFBundleURLSchemes twitterkit-xxxxxxxx FacebookAppID xxxxx Name twitter twitterauth fbapi fb-信使-api fbauth2 fbshareextension xxxxxxxx套件KitInfo KitName Crashlytics

  1. 添加到class AppDelegate上 进口TwitterKit ..。函数应用程序(_ application: UIApplication,didFinishLaunchingWithOptions launchOptions: UIApplicationLaunchOptionsKey: Any?) -> Bool {.Twitter.sharedInstance().start(withConsumerKey:"xxxxxx",consumerSecret:"xxxxx") } func应用程序(_ app: UIApplication,open url: URL,选项: UIApplicationOpenURLOptionsKey : Any =) -> Bool {返回Twitter.sharedInstance().application(app,open: url,options: options) }
  2. 增加框架:

  1. 添加Header.h #import <TwitterKit/TwitterKit.h>
  2. 从正式的TwitterLogInButton添加指南

当我单击按钮登录时,会得到一个错误(在模拟器iOS 9.3上进行了测试):

代码语言:javascript
复制
-canOpenURL: failed for URL: "twitterauth://authorize?consumer_key=xxxSAMExxx&consumer_secret=yyyyyyy&oauth_callback=twitterkit-xxxSAMExxx" - error: "(null)"
[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>Desktop applications only support the oauth_callback value 'oob'</error>
  <request>/oauth/request_token</request>
</hash>
" UserInfo={NSLocalizedDescription=<?xml version="1.0" encoding="UTF-8"?>
<hash>
  <error>Desktop applications only support the oauth_callback value 'oob'</error>
  <request>/oauth/request_token</request>
</hash>
}
EN

回答 1

Stack Overflow用户

发布于 2017-07-27 23:51:14

您需要将CFBundleURLSchemes条目分开,如下所示:

代码语言:javascript
复制
<key>CFBundleURLTypes</key>
<array>
    <dict>
        <key>CFBundleURLSchemes</key>
        <array>
            <string>fbXXX</string>
        </array>
    </dict>
    <dict>
        <key>CFBundleURLSchemes</key>
        <array>
            <string>twitterkit-XXX</string>
        </array>
    </dict>
</array>

您还可能希望从官方Twitter文档中显示的Fabric迁移。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/44970074

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档