2016-09-21 82 views
15

當經由的XCode 8構建應用程序,運行在小牛(OSX 10.9)的應用程序,我接收崩潰,錯誤如下:tokenCount <maxCountIncludingZeroTerminator斷言(OSX 10.9)

Crash stack

蘋果具體做在XCode 8 Release notes並具有以下細節提到這一點:

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)

我試着加入一些3X縮放圖像的項目,但我仍然收到同樣的異常。根據文檔,我只需要添加其中一個屬性來解決問題,但它似乎並沒有爲我所用。有沒有其他人遇到過這個問題?有沒有人有任何決議?

+2

您需要挑選至少五個這些屬性 – JustSid

回答

15

我創建了一個新的圖標,並手動修改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

+0

非常感謝您發佈此問題和解決方案。 – DDP

+0

我遵循這個解決方案,但它仍然崩潰斷言失敗:(tokenCount mKane

+0

嘗試再次下載iconFix.zip文件。我只是做了一個更新和我的原始答案。 – Kyle

3

在我的測試中(也針對macOS 10.9),這隻發生在使用Xcode 8在macOS 10.12上構建時。

macOS 10.11.6上使用Xcode 8構建時,沒有發生啓動時崩潰。

這可能代表了一些人的快速解決方法,雖然凱爾的答案是根據Xcode發行說明確定的。 (我還沒有測試過Xcode 8.1beta)。

更新

和Xcode大廈8.1b2在MacOS 10.12,行爲是一樣的和Xcode 8.0。 (下一個測試將建立在10.12.1測試版上)

+0

我有同樣的問題,我更新了Touchbar的應用程序,現在它們都在10.12.1上崩潰.Kyle解決方案似乎目前工作正常。 – Tibidabo