I have been following a tutorial to create a to-do list. I have a Tab Bar View Controller already managing 2 sets of Table View Controllers (WeekAViewController - item #1 & WeekBViewController - item 2).
Now, when I connect my Tab Bar View Controller to AllListsViewController (to become my 3rd set or item - code is down below), I get the following message in the debug window pointing to my AppDelegate:
Could not cast value of type 'UITabBarController' (0x1ad56a0) to 'UINavigationController' (0x1ad5678). (lldb)
How could I resolve this issue, please? (App Delegate code below)
Thanks
import UIKit
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
let dataModel = DataModel()
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
let navigationController = window!.rootViewController as! UINavigationController
let controller = navigationController.viewControllers[0] as! AllListsViewController
controller.dataModel = dataModel
return true
}
...
func applicationDidEnterBackground(application: UIApplication) {
saveData()
}
...
func applicationWillTerminate(application: UIApplication) {
saveData()
}
func saveData() {
dataModel.saveChecklists()
}
}