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

后端 未结 4 790
忘了有多久
忘了有多久 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:22

    Hej, allesamme,

    I had the same problem and have been researching it for days. I found a family of four solutions, the first three of which did not work for me: 1. using a .png file as the document type icon file; 2. using a manually created .icns file as the document type icon file; 3. the above solution, and 4. what I will describe here. Only the last one worked for me.

    I tried following the spirit of the above advice and found that it didn't work, at least for my MacOS app. I'm on OS X 10.9.2 (13C64) running Xcode Version 5.1 (5B130a).

    The current wisdom seems to be to create a directory in your workspace with a lower-case name and .iconset extension, in which one puts files with an icon_ prefix and the usual suffixes (16x16.png, 16x16@2x.png, 32x32.png, etc.)

    In Product Editor's Info pane you can go into Document Types and associate the .iconset file with the Icon field. The icon image happily displays something reasonable. The build process builds a .icns file from that spec and copies it into your app.

    I had an intermittent problem that the .icns file wouldn't build, which I traced to mistakenly haven included a 64x64 icon in the list. That's a no-no.

    The current Apple dogma on this issue can be found in the official documentation, which covers some details I glossed over here. I didn't need to edit the Info.plist file directly: everything seemed to work from the interfaces provided in Xcode.

    I have no idea which solutions work in which contexts, but thought I'd add throw more alternative on the fire for people to try out. — Jim Coplien

提交回复
热议问题