【发布时间】:2017-11-22 21:21:51
【问题描述】:
我使用的面料没有问题,但是自从新的 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")
}
}
以下是应用委托 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 上分享时,twitter 作曲家被调用并且在“composer.show”行应用程序崩溃。由于 ios11 内置帐户功能的更改,我需要使用 twitter sdk 删除
【问题讨论】:
-
你可以通过 pod "pod 'TwitterKit'" 来添加 twitterKit
-
是的,我确实安装了 pod,所有代码都运行良好...应用程序共享按钮操作中发生错误...composer.show 行
-
你在同一个 URLSchema 中实现了 fb key 和 twitter key
-
是的 fb 和 twitter 密钥是相同的,但即使删除 fbkey 也不能解决问题
标签: ios swift twitter twitterkit