9

所以,我有一个在很多应用程序之间共享的 xcassets。我在安装了 MacOs Sierra 的 Mac Mini 中使用 Xcode8 进行开发。如果我在开发机器上编译运行,完全没有问题。但是,当我尝试在带有 OSX Mavericks 的设备中运行它时,我遇到了崩溃。这是报告中的跟踪

Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0   libsystem_kernel.dylib          0x00007fff887dc866 __pthread_kill + 10
1   libsystem_pthread.dylib         0x00007fff87a3935c pthread_kill + 92
2   libsystem_c.dylib               0x00007fff88614bba abort + 125
3   libsystem_c.dylib               0x00007fff885dea5f __assert_rtn + 321
4   com.apple.coreui                0x00007fff875aa1a7 CUIRenditionKeySetValueForAttribute + 307
5   com.apple.coreui                0x00007fff875a9004 -[CUIStructuredThemeStore _canGetRenditionWithKey:isFPO:lookForSubstitutions:] + 200
6   com.apple.coreui                0x00007fff875a8f1b -[CUIStructuredThemeStore canGetRenditionWithKey:] + 22
7   com.apple.coreui                0x00007fff875c4eab -[CUICatalog _resolvedRenditionKeyForName:scaleFactor:deviceIdiom:deviceSubtype:] + 291
8   com.apple.coreui                0x00007fff875c4c53 -[CUICatalog imageWithName:scaleFactor:deviceIdiom:deviceSubtype:] + 29
9   com.apple.AppKit                0x00007fff88820b1b +[NSImage _catalogImageWithName:bundle:] + 132
10  com.apple.AppKit                0x00007fff8881aefd +[NSImage imageNamed:] + 261

如果我从 xcassets 中删除图像并将其“单独”包含在应用程序的包中 - 通过将其拖放到应用程序的项目导航器中 - 它加载得很好。但如果可能的话,我想避免这种情况,因为只在一个 xcasset 中共享图像会更干净。

有什么想法或想法吗?提前致谢。

4

1 回答 1

8

我可以按照Apple为 iOS 7 设备提供的解决方法绕过此错误:

要解决此问题,请将部署目标更新到 iOS 8.0 或更高版本,或将单个图像添加到资产目录中,该图像集至少具有跨图像集指定的五个属性,例如:scale (1x, 2x, 3x) idiom (添加 iPad、iPhone 和通用资产)方向(从左到右、从右到左)宽度/高度类(任意和紧凑等)内存(添加 1 GB 资产)图形(添加 Metal 1v2 资产)它无需在代码中使用图像或添加所有这些属性。(27852391)

这是这个虚拟图像集的样子:

虚拟图像集

于 2016-10-03T20:45:27.943 回答