我使用了Fabric没有问题但是因为新的twitterkit 3.0更新我遵循了所有安装文档但是当我使用TWTRComposer时,我的应用程序崩溃了以下消息:"' TWTRInvalidInitializationException',原因: '在应用程序设置中未设置有效的Twitter工具包URL计划的情况下尝试登录或使用推文。"似乎无法找到解决方案。
// Swift
let composer = TWTRComposer()
composer.setText("just setting up my Twitter Kit")
composer.setImage(image.image)
// Called from a UIViewController
composer.show(from: self.navigationController!) { (result) in
if (result == .done) {
print("Successfully composed Tweet")
} else {
print("Cancelled composing")
}
}
下面是app delegate didFinishLaunchingWithOptions代码
Twitter.sharedInstance().start(withConsumerKey:"xxxxxxxxxxxx", consumerSecret:"xxxxxxxxxxxxxxxxxxxxxxxxxxxxx")
以下是我的infoPlist代码
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleURLSchemes</key>
<array>
<string>twitterkit-consumentkeyxxxxxxx</string>
<string>fbkeyxxxxxxxxxxxx</string>
<string>xxxxxxxxx</string>
</array>
</dict>
</array>
<key>LSApplicationQueriesSchemes</key>
<array>
<string>fbapi</string>
<string>fb-messenger-api</string>
<string>fbauth2</string>
<string>fbshareextension</string>
<string>twitter</string>
<string>twitterauth</string>
</array>
在应用程序启动时没有问题,但是当我按下按钮在Twitter上分享时,推特作曲家就会打电话并打开&#34; composer.show&#34;线应用程序崩溃。我需要使用twitter sdk,因为更改了ios11内置帐户功能删除
答案 0 :(得分:9)
您需要单独添加密钥:
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleTypeRole</key>
<string>Editor</string>
<key>CFBundleURLSchemes</key>
<array>
<string>fb-fbid-</string>
</array>
</dict>
<dict>
<key>CFBundleTypeRole</key>
<string>Editor</string>
<key>CFBundleURLSchemes</key>
<array>
<string>twitterkit-twitterKey</string>
</array>
</dict>
</array>