取代Main.storyboard,以某种方式打破了布线

时间:2014-12-13 14:02:13

标签: xcode swift interface-builder

帮助!我是一个项目的几天,我愚蠢地开始作为目标C,然后意识到"我是网络开发人员,显然我应该切换到Swift,因为它存在!",所以我创建了一个来自同一个Xcode模板(Master-Detail Application)的新Swift项目,复制到我的Main.storyboard和.xcdatamodeld中,然后开始移植我写给swift的所有代码。有一天,我准备好测试我的移植代码......

但应用程序崩溃了:

func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
    // Override point for customization after application launch.
    let splitViewController = self.window!.rootViewController as UISplitViewController
    let navigationController = splitViewController.viewControllers[splitViewController.viewControllers.count-1] as UINavigationController
    navigationController.topViewController.navigationItem.leftBarButtonItem = splitViewController.displayModeButtonItem()
    splitViewController.delegate = self

    let masterNavigationController = splitViewController.viewControllers[0] as UINavigationController
>>  let controller = masterNavigationController.topViewController as MasterViewController
    controller.managedObjectContext = self.managedObjectContext
    return true
}

修改

调试控制台说:

2014-12-13 14:45:28.323 Rings[12765:760712] Unknown class MasterViewController in Interface Builder file.
2014-12-13 14:45:28.332 Rings[12765:760712] Unknown class DetailViewController in Interface Builder file.
Printing description of *(masterNavigationController._navigationBar):

(UINavigationBar)[0] = {}

...但这两个类至少存在 - 我想这是断开连接的地方?


我想如果我确保我的代码中的所有IBOutlets和IBActions都被命名并键入相同的(它们是)旧的Main.storyboard在新项目中运行正常....但似乎有些东西是断开连接的故事板IB对象和AppDelegate的视图控制器设置代码之间。我甚至不确定在哪里看。任何人都可以告诉我从哪里开始寻找?

0 个答案:

没有答案