How to manually create icns files using iconutil?

前端 未结 18 2025
无人共我
无人共我 2020-11-29 15:08

When I\'m validating my app I get this error:

the application bundle does not contain an icon in ICNS format, containing both a 512x512

18条回答
  •  失恋的感觉
    2020-11-29 15:32

    There are 2 tasks:
    - create 10 correct icns files
    - get your Xcode project to use them correctly

    As I had hour long problems with both of these tasks, and also do not like when I don't 'see' what is going on, here a path for the cautious ones:

    Create 10 correct icns files:
    I used the script above from Henry: It still works for HighSierra and Xcode 9.2, including the 'c' command.
    The icns file I got, appeared as only one icon size in Finder/Quicklook and in Preview showed only 8 of 10 sizes.
    So I used terminal, went with cd to my folder and used the command: iconutil -c iconset (icns filename) on the just created icns file to revert the icns file back to an iconset folder, and - lo & behold - I could see my newly created 10 icon files. Using Quick look on the iconset folder (and using full screen mode to be able to zoom through them with the slider), I could check that all sizes are actually looking very well.

    As an aside: they looked better than my resizing attempts with PSE, most likely because I did not take the time to play with all the resizing options in PSE. If you do use PSE, make sure your png files are saved without colour profile. Also, confessing my ignorance, for me a 256x256@2 file is the same as a 512x512 file - both in 72dpi. Trying to follow the 144 dpi comments above did not work for me.

    Get your Xcode project to use them correctly:
    First I deleted all my fruitless attempts within Xcode and committed a clean version to the git repository (what would have been clever, would have been to commit a clean version first - before I frantically started the icon addition odyssee).
    I also made sure that in the info.plist file there is no pointer linked to the 'icon file' entry and that in my General project settings I had chosen AppIcon for App Icons.
    Then I added an assets.asset catalog and within the assets catalog a new 'AppIcons and Launch Images' AppIcon Folder for OS.
    Then I copied (drag and drop with option pressed) from the iconset folder each png picture file into the respective AppIcon Spaceholder. So again, I could see what is happening. Xcode did convert that into icns files, or maybe - as my iconset folder derived from an icns folder - the file formats were accepted.

    Then archive and validate and there will be no errors upon uploading or validating.

提交回复
热议问题