iOS Swift 2 Twitter登录集成

问题描述 投票:0回答:2

我想在我的项目中集成Twitter登录。我正在使用Xcode7并关注Twitter login tutorial。但我收到AppDelegate value of type 'Twitter' has no member start中的错误。我已经安装了pod 'TwitterKit'并在#import <TwitterKit/TwitterKit.h>中添加了bridging header。下面是AppDelegate中的代码

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
Twitter.sharedInstance().start(withConsumerKey:"hTpkPVU4pThkM0", consumerSecret:"ovEqziMzLpUOF163Qg2mj")

return true
}

任何帮助,将不胜感激。提前致谢

ios twitter swift2 xcode7
2个回答
1
投票

从你的代码看起来你似乎使用Swift2但你使用Swift3方法为Twitterkit

使用这个Swift2方法再试一次,它应该适合你

Twitter.sharedInstance().startWithConsumerKey("your_key", consumerSecret: "your_secret")

2
投票

使用此对于Swift4.0

TWTRTwitter.sharedInstance().start(withConsumerKey: "your_key", consumerSecret: "your_secret")
© www.soinside.com 2019 - 2024. All rights reserved.