我有一个基于故事板的应用程序。我删除了故事板,因为我不需要它。
现在,当我将项目构建到模拟器时,它正在运行,但是当我尝试部署到真实设备时,它会抛出这个:
由于未捕获的异常'NSInvalidArgumentException'而终止应用程序,原因:'无法在捆绑包中找到名为'Main'的故事板NSBundle(已加载)'
我不想使用故事板..它在哪里尝试加载“主要”故事板?我可以在哪里删除它?
更新:
var window: UIWindow?
var mainNavigationController: UINavigationController?
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
self.mainNavigationController = UINavigationController()
var mainController: UIViewController? = TineLineViewController()
self.mainNavigationController!.pushViewController(mainController!, animated: false)
self.window = UIWindow(frame: UIScreen.mainScreen().bounds)
self.window!.rootViewController = mainController
self.window!.makeKeyAndVisible()
谢谢你,我现在更新了我的AppDelagate didFinishLaunchingWithOptions方法。主控制器屏幕显示,但我有一个UISwipeGestureRecognizer不处理我的请求..这是我的UISwipeGestureRecognizer:
let postLeft : Selector = "postLeft:"
let postLeftSwipe = UISwipeGestureRecognizer(target: self, action: postLeft)
postLeftSwipe.direction = UISwipeGestureRecognizerDirection.Left
goToPostButton.addGestureRecognizer(postLeftSwipe)
我应该改变什么吗?
谢谢!
答案 0 :(得分:1)
application:didFinishLaunching:
中,并将视图控制器设置为应用程序主rootViewController
的{{1}}对象(或将其嵌入UIWindow
或UINavigationController
,您可以将其设置为UITabBarController
的{{1}}。找到代码如何执行此操作here:)