Twitter.sharedInstance()不存在swift TwitterKit

The*_*Guy 2 twitter ios cocoapods swift twitterkit

我是Xcode和swift的新手.

我已经开始使用TwitterKit,我已经使用cocoapods在我的项目上安装了它,我遵循了这个教程:https://dev.twitter.com/twitterkit/ios/installation

问题是,当我尝试在AppDelegate中初始化TwitterKit时,我无法使用Twitter.sharedInstace,因为Twitter不存在.(我已经在AppDelegate中导入了TwitterKit import TwitterKit)

这是我的App Delegete课程:

import UIKit
import TwitterKit
import Firebase
import FirebaseAuth

@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {

var window: UIWindow?


    func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
        // Override point for customization after application launch.
        Twitter.sharedInstance().start(withConsumerKey:"********", consumerSecret:"*******") 
        //Here I get the error: Use of unresolved identifier 'Twitter'       
        return true
        }
Run Code Online (Sandbox Code Playgroud)

我究竟做错了什么?

bl4*_*0se 9

如果你使用Swift 4,你需要使用几乎TwitterSharedInstance()的TWTRTwitter.sharedInstance(),因为Twitter类已被TWTRTwitter取代.使用Object C你没有这个问题,因为有一个宏隐藏了这个变化.不幸的是,"dev.twitter.com"尚未更新.