将应用程序升级到 Swift 4 和 iOS 11 - TwitterKit 问题 [英] Upgrading App to Swift 4 and iOS 11 - TwitterKit Issues
问题描述
我正在尝试将我的应用升级到最新的 iOS 支持.我已经通过 CocoaPods 添加了 TwitterKit,并在我的 Bridge Header 中放置了标题.然而;我收到一条错误消息:
I'm trying to upgrade my app to latest iOS support. I've added TwitterKit via CocoaPods, and placed header in my Bridge Header. However; I am getting an error saying:
使用未解析的已识别Twitter" - 您的意思是TWTRTTwitter"吗.
Use of unresolved identified 'Twitter' - did you mean 'TWTRTTwitter'.
func application(_ application: UIApplication, didFinishLaunchingWithOptions lauunchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
Twitter.sharedInstance().start(withConsumerKey:"MYKEY", consumerSecret:"MYSECRET")
return true
}
这是推特推荐的代码.我也在:
This right out of the Twitter recommended code. I also get it at:
func application(_ app: UIApplication, open url: URL, options: [UIApplicationOpenURLOptionsKey : Any] = [:]) -> Bool {
let handled:Bool = true
Twitter.sharedInstance().application(app, open: url, options: options)
return handled
}
有什么指点吗?
推荐答案
谢谢你,Andy Piper,我解决了以下问题:
Thank you, Andy Piper, I fixed the issue as following:
更新了 pod,以便 TwitterCore 3.1.0 和 TwitterKit 3.3.0
Updated pod so that TwitterCore 3.1.0 and TwitterKit 3.3.0
在 Bridging-Header.h 文件中
In Bridging-Header.h file
导入为TwitterKit/TWTRKit.h 而不是TwitterKit/TwitterKit.h
imported as TwitterKit/TWTRKit.h instead of TwitterKit/TwitterKit.h
在 didFinishLaunchingWithOptions 中,
In didFinishLaunchingWithOptions,
- 修改 Twitter.sharedInstance().start(withConsumerKey: 你的消费者密钥", consumerSecret:"你的消费者秘密")
TWTRTwitter.sharedInstance().start(withConsumerKey: 你的消费者密钥", consumerSecret:"你的消费者秘密")
TWTRTwitter.sharedInstance().start(withConsumerKey: "your consumer key", consumerSecret:"your consumer secret")
即在使用它的地方用 TWTRTwitter 替换 Twiter.
i.e replace Twiter with TWTRTwitter where it is used.
- 不需要用fabric初始化,所以去掉这行或者去掉
Fabric.with([Twitter.self]) 或 Fabric.with([TWTRTwitter.self])
Fabric.with([Twitter.self]) or Fabric.with([TWTRTwitter.self])
这篇关于将应用程序升级到 Swift 4 和 iOS 11 - TwitterKit 问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!