iOS7 中的错误。视图控制器不会显示
Error in iOS7. view controller won't show
有个奇怪的问题让我有点恐慌。刚刚在 iOS7 上测试了我的应用程序,当时我尝试通过 segue 显示我的视图控制器之一。我收到错误消息:
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '`**Application tried to present a nil modal view controller on target <SendMessageViewController: 0x15524320>.'**`
不知道为什么会这样。它在 iOS8 中运行良好,但有人可以给我一些提示,指出我可能做错了什么吗?
首先检查 viewcontroller 的标识符是否与您在情节提要中提到的相同。
然后在此异常上设置返回点以查看模型是否 nill。
UIAlertController
不受 iOS 7 支持,因此在您的情况下,您应该检查 iOS 设备的版本并使用特定逻辑。
使用条件检测是否可以使用UIAlertController
if NSClassFromString("UIAlertController") != nil {
// Use it
} else {
// Fall back
}
有个奇怪的问题让我有点恐慌。刚刚在 iOS7 上测试了我的应用程序,当时我尝试通过 segue 显示我的视图控制器之一。我收到错误消息:
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '`**Application tried to present a nil modal view controller on target <SendMessageViewController: 0x15524320>.'**`
不知道为什么会这样。它在 iOS8 中运行良好,但有人可以给我一些提示,指出我可能做错了什么吗?
首先检查 viewcontroller 的标识符是否与您在情节提要中提到的相同。
然后在此异常上设置返回点以查看模型是否 nill。
UIAlertController
不受 iOS 7 支持,因此在您的情况下,您应该检查 iOS 设备的版本并使用特定逻辑。
使用条件检测是否可以使用UIAlertController
if NSClassFromString("UIAlertController") != nil {
// Use it
} else {
// Fall back
}