我是Objective C
和Swift
的新手。在这里,我的示例程序中有'NSInternalInconsistencyException'
例外。我执行以下步骤,这是我在Swift中的第一个程序,我对Objective C不熟悉。
CheckingController.xib:
我创建了一个Sample Button
。
AppDelegate.swift:
import UIKit
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
var navigationController: UINavigationController?
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: NSDictionary?) -> Bool {
self.window = UIWindow(frame: UIScreen.mainScreen().bounds)
// Override point for customization after application launch.
self.window!.backgroundColor = UIColor.whiteColor()
self.window!.makeKeyAndVisible()
var mainController: CheckingController? = CheckingController(nibName: "CheckingController", bundle: nil)
self.navigationController = UINavigationController(rootViewController: mainController)
self.window!.rootViewController = self.navigationController
return true
}
func applicationWillResignActive(application: UIApplication) {
}
CheckingController.swift:
import Foundation
import UIKit
class CheckingController: UIViewController{
init(nibName nibNameOrNil: String!, bundle nibBundleOrNil: NSBundle!) {
super.init(nibName: nibNameOrNil, bundle: nibBundleOrNil)
}
override func viewDidLoad() {
super.viewDidLoad()
}
}
需要一些指导,说明这里可能出现的问题以及解决方法。
感谢。
答案 0 :(得分:0)
我按照以下步骤操作并修正了错误:
提到here