简体   繁体   中英

iOS Swift 2 Twitter Login integration

I am trying to integrate Twitter login in my project. I am using Xcode7 and following Twitter login tutorial . But I am getting the error in AppDelegate value of type 'Twitter' has no member start . I have installed pod 'TwitterKit' and added #import <TwitterKit/TwitterKit.h> in bridging header . Below is the code in AppDelegate

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

return true
}

any help would be appreciated. Thanks in advance

From your code it seems like you are using Swift2 but you are using Swift3 method for Twitterkit

Use this Swift2 method and try again, It should work for you

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

将此用于Swift4.0

TWTRTwitter.sharedInstance().start(withConsumerKey: "your_key", consumerSecret: "your_secret")

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM