[UIDeviceRGBColor countByEnumeratingWithState:objects:count:]: 无法识别的选择器发送到实例 0x16577e10 -> makeKeyAndVisible 后崩溃

[UIDeviceRGBColor countByEnumeratingWithState:objects:count:]: unrecognized selector sent to instance 0x16577e10 -> A Crash After makeKeyAndVisible

调试时出现以下错误,发现在这一行之后,应用程序崩溃了:

[self.window makeKeyAndVisible];

当尝试通过 Xcode 8.0 在设备上 运行 时,出现以下错误日志:

2016-10-03 11:03:59.827994 Slots[5972:1125279] -[UIDeviceRGBColor countByEnumeratingWithState:objects:count:]: unrecognized selector sent to instance 0x16577e10

2016-10-03 11:03:59.830292 Slots[5972:1125279] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UIDeviceRGBColor countByEnumeratingWithState:objects:count:]: unrecognized selector sent to instance 0x16577e10'

* First throw call stack: (0x1db25e07 0x1cd8b077 0x1db2b515 0x1db29589 0x1da4ef08 0x2303d18d 0x23037bff 0x1e3b39a5 0x1e3b2e6d 0x23047fc9 0x23048641 0x1e3b39a5 0x1e3b9d3d 0x1e354ca7 0x1e3b39a5 0x1e3b2e6d 0x23047507 0x22ec2589 0x22c9eecb 0x22b6b067 0x22b6af9f 0x22b716a3 0x22b6eb9d 0x22be1051 0xc3cf1 0x22bdd33b 0x22de9e01 0x22def41f 0x22e01fc5 0x22dec805 0x1f3ea97b 0x1f3ea835 0x1f3eab1f 0x1dae1c8b 0x1dae1795 0x1dadfa6b 0x1da2f073 0x1da2ee81 0x22bd6b69 0x22bd1201 0xc398f 0x1d1fa50b) **libc++abi.dylib: terminating with uncaught exception of type NSException

任何可能导致此崩溃的想法。我没有故事板,只有xibs。

使用 xib's.

加载视图或初始化视图 from/or 时,iOS 10xcode8 出现相同问题

您可以尝试以下解决方案:

  1. 转到你的接口文件,意思是Xib'sNib's

  2. 在右侧,导航到 文件检查器 选项卡。

  3. "Build for" 的值更改为 "iOS 7.0 and Later" 或任何其他 iOS版本及以后。

  4. 清理、重建和 运行 项目。

检查图像以供参考:

当我在 Xcode 8.3.1 中打开我的 iOS 6 项目时。当我 运行 构建 iOS 9.1 及更高版本时出现此错误。

打开 nib 文件并将界面生成器文档选项 "Builds for" 选项更改为 "iOS 7.0 and later" 解决了这个问题。