我一直在关注 this tutorial religiously它已针对 Swift 2.0 和 Xcode 7.1 (根据标题,我使用的是 Xcode 7.2.1 Swift 2.2) 进行了验证,所以我卡在了文章“使用您的新 CocoaPod”上实现它。我严格按照它进行操作,我的应用委托(delegate)看起来像这样:
import UIKit
import RWPickFlavor
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
var rootViewController: UIViewController!
func application(application: UIApplication, didFinishLaunchingWithOptions
launchOptions: [NSObject : AnyObject]?) -> Bool {
setupRootViewController()
window = UIWindow(frame: UIScreen.mainScreen().bounds)
window?.rootViewController = rootViewController
window?.makeKeyAndVisible()
return true
}
func setupRootViewController() {
let bundle = NSBundle(forClass: PickFlavorViewController.self)
let storyboard = UIStoryboard(name: "Main", bundle: bundle)
rootViewController = storyboard.instantiateInitialViewController()!
}
}
但是我在下面一行有一个错误:
let bundle = NSBundle(forClass: PickFlavorViewController.self)
错误消息显示:“使用未解析的标识符‘PickFlavorViewController’”
在 swift 2.0 和 2.2 之间是否发生了影响 CocoaPods 的事情,我该如何解决?
最佳答案
看起来您没有将 PickFlavorViewController 复制到您的项目中,您的教程中提到了这一点:
现在将 IceCreamShop.xcworkspace 中上述组中的所有内容(AppDelegate.swift 和 LaunchScreen.xib 除外)拖放到 RWPickFlavor.xcworkspace 中的相应组中,如下所示:
复制 Controller ,一切都应该没问题。祝你好运!
关于ios - 无法从 Cocoapod Xcode 7.2.1 Swift 2.2 解析标识符,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36564155/