【问题标题】:tokenCount < maxCountIncludingZeroTerminator assertion (osx 10.9)tokenCount < maxCountIncludingZeroTerminator 断言(osx 10.9)
【发布时间】:2016-09-21 12:16:29
【问题描述】:

通过 XCode 8 构建应用程序并在 Mavericks (OSX 10.9) 上运行应用程序时,我收到崩溃并显示以下错误:

Apple 确实在 XCode 8 Release notes 中特别提到了这一点,并附有以下详细信息:

资产目录

使用 Xcode 8 编译的应用程序和部署 iOS 7 的目标可能会在启动时崩溃,并带有以下断言:

断言失败:(maxCountIncludingZeroTerminator > 0 && tokenCount

要解决此问题,请将部署目标更新为 iOS 8.0 或更高版本,或将单个图像添加到具有 至少在图像集中指定了五个属性,例如:

  • 缩放(1x、2x、3x)
  • 成语(添加 iPad、iPhone 和通用资产)
  • 方向(从左到右,从右到左)
  • 宽度/高度类(任意和紧凑等)
  • 内存(添加 1 GB 资产)
  • 图形(添加金属 1v2 资产)

无需在代码中使用图像或添加 所有这些属性。 (27852391)

我尝试在项目中添加一些 3 倍缩放的图像,但我仍然收到相同的异常。根据文档,我只需要添加其中一个属性来解决问题,但是它似乎对我没有用。有没有其他人遇到过这个?有人有解决办法吗?

【问题讨论】:

  • 您需要至少选择其中五个属性

标签: macos xcode8


【解决方案1】:

我创建了一个新图标并手动修改了 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

【讨论】:

  • 非常感谢您发布这个问题和解决方案。
  • 我遵循了这个解决方案,但它仍然崩溃断言失败:(tokenCount
  • 尝试再次下载 iconFix.zip 文件。我刚刚更新了它和我原来的答案。
  • 谢谢你;如果不需要,我不想要求 10.10。
  • @Kyle +1 我遇到了同样的问题。我添加了你的文件,它似乎工作。我必须将它添加到我的所有资产目录还是只添加到一个?
【解决方案2】:

在我的测试中(也针对 macOS 10.9),这仅在使用 Xcode 8 在 macOS 10.12 上构建时发生。

macOS 10.11.6 上使用 Xcode 8 构建时不会发生启动时崩溃。

这对某些人来说可能是一种快速的解决方法,尽管根据 Xcode 发行说明,Kyle 的回答是确定的。 (我还没有测试过 Xcode 8.1beta)。

更新

在 macOS 10.12 上使用 Xcode 8.1b2 构建,行为与使用 Xcode 8.0 相同。 (下一次测试将在 10.12.1 beta 上构建)

【讨论】:

  • 我遇到了同样的问题,我为 Touchbar 更新了我的应用程序,现在它们都在 10.12.1 上崩溃了 Kyle 解决方案到目前为止似乎有效。
猜你喜欢
  • 2013-11-07
  • 2013-11-07
  • 2014-05-28
  • 1970-01-01
  • 2014-08-23
  • 2013-06-23
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多