Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

tokenCount < maxCountIncludingZeroTerminator assertion (osx 10.9)

Tags:

macos

xcode8

When building an app via XCode 8, running the application on Mavericks (OSX 10.9), I receive a crash with the following error:

Crash stack

Apple does specifically mention this in the XCode 8 Release notes with the following details:

Asset Catalogs

Applications compiled with Xcode 8 and a deployment target of iOS 7 may crash at launch with the following assertion:

Assertion failed: (maxCountIncludingZeroTerminator > 0 && tokenCount < maxCountIncludingZeroTerminator), function CUIRenditionKeyCopy, file /SourceCache/CoreUI/CoreUI-232.4/CoreTheme/ThemeStorage/CUIThemeRendition.m, line 185.

To work around this issue, update the deployment target to iOS 8.0 or higher, or add a single image to the asset catalog that has at least five attributes specified across the image set, such as:

  • scale (1x, 2x, 3x)
  • idiom (add iPad,iPhone, and a universal asset)
  • direction (left to right, right to left)
  • width/height class (any & compact, and so forth)
  • memory (add a 1 GB asset)
  • graphics (add a Metal 1v2 asset)

It is not necessary to use the image in your code or to add all of these attributes. (27852391)

I've tried adding some 3x scaled images to the project, however I still receive the same exception. According to the documentation I only need to add one of those attributes to resolve the issue, however it does not seem to do the trick for me. Has anyone else run into this? Does anyone have any resolution?

like image 693
Kyle Avatar asked Sep 21 '16 12:09

Kyle


Video Answer


2 Answers

I created a new icon and manually modified the json file to contain the following:

{
  "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"
  }
}

I do not actually use this icon anywhere. This sorted the issue. I have uploaded the icon here if anyone runs into this issue and needs it.

like image 179
Kyle Avatar answered Sep 28 '22 10:09

Kyle


In my testing (also targetting macOS 10.9), this only occurred when building with Xcode 8 on macOS 10.12.

The crash at launch did not occur when building with Xcode 8 on macOS 10.11.6.

This might represent a quick work-around for some people, although Kyle's answer is definitive as per the Xcode release notes. (I have not tested Xcode 8.1beta).

Update

Building with Xcode 8.1b2 on macOS 10.12, the behaviour is the same as with Xcode 8.0. (Next test will be building on the 10.12.1 beta)

like image 23
DDP Avatar answered Sep 28 '22 10:09

DDP