【swift1.1】ストリーボードは使わないので削除して開発〜validateまでうまくいく方法
1.まずxcodeの左側にあるツリーから「Main.storyboard」を右クリックで適当に削除。似たようなもので「LaunchScreen.xib」も邪魔なので同様に削除
2.xcode開発ではよく操作する「TARGETS ー Info」Info.plist から 「Main storyboard file base name」 をーボタンで適当に削除 Main〜(iPhone)やMain〜(iPad)があれば同様に削除
3.「AppDelegate.swift」ファイルの「 func application(〜」(普通一番上にあるやつ)内に以下を記述
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
self.window = UIWindow(frame: UIScreen.mainScreen().bounds) //ストーリーボードを削除した時必要
self.window!.rootViewController = ViewController() //これで起動時のルートクラスをViewControllerに設定する
self.window!.backgroundColor = UIColor.whiteColor() //ストーリーボードを削除した時必要
self.window!.makeKeyAndVisible() //ストーリーボードを削除した時必要
return true
}
参考:(役に立った順)
http://swift-salaryman.com/uiwindow.php
http://kzy52.com/entry/2014/10/19/232254