当通过XCode 8构建应用程序,在Mavericks(OSX 10.9)上运行应用程序时,我收到崩溃,并出现以下错误:
Apple在XCode 8 Release notes中特别提到了这一点,并提供了以下详细信息:
资产目录
使用Xcode 8和部署编译的应用程序 iOS 7的目标可能会在启动时崩溃,并带有以下断言:
断言失败:(maxCountIncludingZeroTerminator> 0&& tokenCount< maxCountIncludingZeroTerminator),函数CUIRenditionKeyCopy,file /SourceCache/CoreUI/CoreUI-232.4/CoreTheme/ThemeStorage/CUIThemeRendition.m, 第185行。
要解决此问题,请将部署目标更新为 iOS 8.0或更高版本,或将单个图像添加到具有的资产目录 在图像集中指定至少五个属性,例如:
- 比例(1x,2x,3x)
- idiom(添加iPad,iPhone和通用资产)
- 方向(从左到右,从右到左)
- 宽度/高度等级(任何&紧凑等等)
- 内存(添加1 GB资产)
- 图形(添加金属 1v2资产)
没有必要在代码中使用图像或添加 所有这些属性。 (27852391)
我尝试将一些3x缩放图像添加到项目中,但是我仍然收到相同的异常。根据文档我只需要添加其中一个属性来解决问题,但它似乎并没有为我做的伎俩。有没有其他人遇到这个?有没有人有任何决议?
答案 0 :(得分:16)
我创建了一个新图标并手动修改了json文件以包含以下内容:
{
"images" : [
{
"idiom" : "universal",
"filename" : "apple-17.png",
"language-direction" : "right-to-left",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "apple-18.png",
"graphics-feature-set" : "metal1v2",
"language-direction" : "right-to-left",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "apple-39.png",
"language-direction" : "right-to-left",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "apple-38.png",
"graphics-feature-set" : "metal1v2",
"language-direction" : "right-to-left",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "apple-48.png",
"language-direction" : "right-to-left",
"scale" : "3x"
},
{
"idiom" : "universal",
"filename" : "apple-49.png",
"graphics-feature-set" : "metal1v2",
"language-direction" : "right-to-left",
"scale" : "3x"
},
{
"idiom" : "universal",
"filename" : "apple-19.png",
"language-direction" : "right-to-left",
"height-class" : "regular",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "apple-20.png",
"graphics-feature-set" : "metal1v2",
"language-direction" : "right-to-left",
"height-class" : "regular",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "apple-37.png",
"language-direction" : "right-to-left",
"height-class" : "regular",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "apple-36.png",
"graphics-feature-set" : "metal1v2",
"language-direction" : "right-to-left",
"height-class" : "regular",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "apple-50.png",
"language-direction" : "right-to-left",
"height-class" : "regular",
"scale" : "3x"
},
{
"idiom" : "universal",
"filename" : "apple-51.png",
"graphics-feature-set" : "metal1v2",
"language-direction" : "right-to-left",
"height-class" : "regular",
"scale" : "3x"
},
{
"idiom" : "universal",
"filename" : "apple-21.png",
"width-class" : "regular",
"language-direction" : "right-to-left",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "apple-22.png",
"width-class" : "regular",
"graphics-feature-set" : "metal1v2",
"language-direction" : "right-to-left",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "apple-35.png",
"width-class" : "regular",
"language-direction" : "right-to-left",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "apple-34.png",
"width-class" : "regular",
"graphics-feature-set" : "metal1v2",
"language-direction" : "right-to-left",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "apple-52.png",
"width-class" : "regular",
"language-direction" : "right-to-left",
"scale" : "3x"
},
{
"idiom" : "universal",
"filename" : "apple-53.png",
"width-class" : "regular",
"graphics-feature-set" : "metal1v2",
"language-direction" : "right-to-left",
"scale" : "3x"
},
{
"idiom" : "universal",
"filename" : "apple-23.png",
"width-class" : "regular",
"language-direction" : "right-to-left",
"height-class" : "regular",
"scale" : "1x"
},
{
"language-direction" : "right-to-left",
"graphics-feature-set" : "metal1v2",
"idiom" : "universal",
"width-class" : "regular",
"filename" : "apple-16.png",
"height-class" : "regular",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "apple-33.png",
"width-class" : "regular",
"language-direction" : "right-to-left",
"height-class" : "regular",
"scale" : "2x"
},
{
"language-direction" : "right-to-left",
"graphics-feature-set" : "metal1v2",
"idiom" : "universal",
"width-class" : "regular",
"filename" : "apple-32.png",
"height-class" : "regular",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "apple-54.png",
"width-class" : "regular",
"language-direction" : "right-to-left",
"height-class" : "regular",
"scale" : "3x"
},
{
"language-direction" : "right-to-left",
"graphics-feature-set" : "metal1v2",
"idiom" : "universal",
"width-class" : "regular",
"filename" : "apple-55.png",
"height-class" : "regular",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
我实际上并没有在任何地方使用此图标。这对问题进行了排序。我已经上传了here图标,如果有人遇到此问题并需要它。
答案 1 :(得分:3)
在我的测试中(同时定位macOS 10.9
),这只发生在macOS 10.12
上使用Xcode 8构建时。
在macOS 10.11.6
上使用Xcode 8构建时,未发生崩溃。
这可能代表了一些人的快速解决方法,尽管根据Xcode发行说明,Kyle的答案是明确的。 (我还没有测试过Xcode 8.1beta)。
<强>更新强>
在macOS 10.12上使用Xcode 8.1b2构建,其行为与Xcode 8.0相同。 (下一个测试将建立在10.12.1测试版上)