How do I access images (for document icons) in an asset catalog in the Xcode 5 product preference editor

后端 未结 4 777
忘了有多久
忘了有多久 2021-02-07 06:57

I think I\'m literally on the last step before submitting a new Mac app, and I\'ve been banging my head against a wall for the past few hours on what I think should be really, r

4条回答
  •  生来不讨喜
    2021-02-07 07:24

    This is what worked for me, using Xcode 10 in 2019 (none of the other answers worked in my case):

    1. Select asset catalog in Project Navigator
    2. Right click on the left pane (list of assets) and choose App Icons & Launch Images ▶︎ New macOS Generic Icon (second option from bottom). Name it "Document". This will create a folder named "Document.iconset" in the asset catalog directory.
    3. Populate all entries with your custom images. They must all be of the appropriate size (e.g., "16 x 16 @2x" must be 32 x 32 pixels, otherwise you will get yellow a warning icon over the image slot).
    4. Navigate to the asset catalog folder, and use the command: iconutil -c icns Document.iconset (must match the name of the icon created in step #2). I took this command from Apple's documentation here (which by the way, also says some BS about Xcode "automatically creating an .icns file from your .iconset folder on build". Sure...).

    5. Copy the newly created Document.icns file as a resource to your project.

    6. Select the target, open the Info pane, and in both Document Types and Exported UTIs set your .icns file as the icon for the file type.

提交回复
热议问题