好的,针对 @null 的精彩帖子,关于使用资源目录,我有以下补充。
为了在Ad-Hoc分发 / 生产中看到应用程序图标链接并正常工作,您可能需要执行以下操作,以在组织者、测试飞行和可能的未知AppStore位置中显示它。
创建资源目录后,请注意Xcode中.xassets
中列出的启动图像和应用程序图标名称。
默认情况下,这应该是
[要查看此内容,请单击您在Xcode中的.xassets文件夹/图标。]
(此内容可更改,因此仅记下此变量以备后用)
现在每次构建会创建以下数据结构:
对于应用程序图标:
iPhone
AppIcon57x57.png
(iPhone非Retina)[注意图标名称前缀]
AppIcon57x57@2x.png
(iPhone Retina)
其他每个图标分辨率也采用相同的格式。
iPad
AppIcon72x72~ipad.png
(iPad非Retina)
AppIcon72x72@2x~ipad.png
(iPad Retina)
(对于iPad,它的后缀略有不同)
主要问题
现在我注意到,在Xcode 5.0.1中,当创建资源目录完成后,它自动尝试并失败地创建一个键“Icon files (iOS 5)
”。
如果它成功地创建了一个引用 / 这可能已被Apple修补或只是有效,那么您所要做的就是查看图像名称以验证上述格式。
最终解决方案:
将以下键添加到您的主要.plist
中。
我建议您使用外部文本编辑器(如TextWrangler)打开您的主.plist
,而不是在Xcode中复制和粘贴以下键。
<key>CFBundleIcons</key>
<dict>
<key>CFBundlePrimaryIcon</key>
<dict>
<key>CFBundleIconFiles</key>
<array>
<string>AppIcon57x57.png</string>
<string>AppIcon57x57@2x.png</string>
<string>AppIcon72x72~ipad.png</string>
<string>AppIcon72x72@2x~ipad.png</string>
</array>
</dict>
</dict>
请注意,我只包含了我的示例分辨率,您需要添加所有分辨率。
如果您想在Xcode中添加此密钥而无需外部编辑器,请使用以下内容:
Icon files (iOS 5)
- 字典
Primary Icon
- 字典
Icon files
- 数组
Item 0
- 字符串= AppIcon57x57.png
每个其他项目 / 应用程序图标都是如此。
现在当您最终归档项目时,最终的.xcarchive有效负载.plist将包括上述声明的图标位置以构建和使用。
请勿向任何.plist添加以下内容:这只是Xcode现在为您的最终有效负载生成的一个示例
<key>IconPaths</key>
<array>
<string>Applications/Example.app/AppIcon57x57.png</string>
<string>Applications/Example.app/AppIcon57x57@2x.png</string>
<string>Applications/Example.app/AppIcon72x72~ipad.png</string>
<string>Applications/Example.app/AppIcon72x72@2x~ipad.png</string>
</array>