我用推特上的官方指南登录
我的脚步:
pod 'Fabric',pod 'TwitterKit'CFBundleURLTypes CFBundleURLSchemes twitterkit-xxxxxxxx FacebookAppID xxxxx Name twitter twitterauth fbapi fb-信使-api fbauth2 fbshareextension xxxxxxxx套件KitInfo KitName Crashlytics
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) }
Header.h #import <TwitterKit/TwitterKit.h>当我单击按钮登录时,会得到一个错误(在模拟器iOS 9.3上进行了测试):
-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>
}发布于 2017-07-27 23:51:14
您需要将CFBundleURLSchemes条目分开,如下所示:
<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迁移。
https://stackoverflow.com/questions/44970074
复制相似问题