Xcode 10 没有命中断点,应用程序启动空白
Xcode 10 no breakpoints are hit and app launches blank
刚刚更新到 Xcode 10 :( 没有任何效果了。
private func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
window = UIWindow()
window?.rootViewController = UIViewController()
window?.makeKeyAndVisible()
return true
}
应用启动并立即变黑。
- 我是运行调试方案
- 代码优化已关闭
- 我已从我的应用程序设置中删除main.storyboard
它甚至没有热我的断点,我在 Appldegate 的第一行有一个断点,但它没有被击中
I have a breakpoint on the first line of Appldegate and it's not getting hit
原来如此。未命中断点,因为未调用您的方法。它没有被调用,因为 Cocoa 看不到它在那里。 Cocoa 看不到它在那里,因为 你 隐藏了它!
全都是关于 Objective-C 和 Swift 之间的关系,以及 Objective-C 如何查看您的 Swift 代码中的内容。
问题出在关键字 private
上。这会导致 Cocoa(即 Objective-C)无法看到您已实现 application:didFinishLaunchingWithOptions:
。它看不到它,所以它不调用它。删除该关键字即可。
刚刚更新到 Xcode 10 :( 没有任何效果了。
private func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
window = UIWindow()
window?.rootViewController = UIViewController()
window?.makeKeyAndVisible()
return true
}
应用启动并立即变黑。
- 我是运行调试方案
- 代码优化已关闭
- 我已从我的应用程序设置中删除main.storyboard
它甚至没有热我的断点,我在 Appldegate 的第一行有一个断点,但它没有被击中
I have a breakpoint on the first line of Appldegate and it's not getting hit
原来如此。未命中断点,因为未调用您的方法。它没有被调用,因为 Cocoa 看不到它在那里。 Cocoa 看不到它在那里,因为 你 隐藏了它!
全都是关于 Objective-C 和 Swift 之间的关系,以及 Objective-C 如何查看您的 Swift 代码中的内容。
问题出在关键字 private
上。这会导致 Cocoa(即 Objective-C)无法看到您已实现 application:didFinishLaunchingWithOptions:
。它看不到它,所以它不调用它。删除该关键字即可。