图标,资产目录和Info.plist混淆 [英] Icons, Asset Catalog and Info.plist confusion

查看:214
本文介绍了图标,资产目录和Info.plist混淆的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一款适用于iOS 5的应用程序,从那时起就一直在更新。对于iOS 7,我已经切换到使用资产目录来获取所有资源,这很好并且似乎运行良好。但是,当我尝试提交给Apple时,我收到验证错误:

I have an app that started life for iOS 5 and has been updated ever since. For iOS 7 I have switched over to using an Asset Catalog for all the resources, which is nice and appears to work well. However, when I try to submit to Apple I get validation errors:


无效的图像路径 - 在key下引用的路径中找不到图像' CFBundleIconFiles':'Icon@2x.png'

Invalid Image Path - No image found at the path referenced under key 'CFBundleIconFiles': 'Icon@2x.png'

我也得到了其他图标的相同错误。这些图标出现在资产目录中,名称 - 直到案例 - 完全符合我的意思。资产目录位于复制软件包资源中,当我在iPhone和iPad(iOS 7)和iOS 6模拟器中运行应用程序时,所有资源都显示在正确的位置。

I get the same error for the other icons, too. These icons do appear in the Asset Catalog and the names -- right down to the case -- match exactly as far as I can tell. The Asset Catalog is in the "Copy Bundle Resources" and all the resources appear in the right place when I run the app on both my iPhone and iPad (in iOS 7) and in the Simulator for iOS 6.

我已更新应用程序以使用iOS 6的最低部署目标。

I have updated the app to use the minimum deployment target of iOS 6.

那么,如何成功将更新提交给Apple ?我是否需要Info.plist中的引用?我还应该检查其他任何设置吗?警告是否是虚假的,我应该忽略(在提升雷达之后)?

So, how do I successfully submit my update to Apple? Do I need the references in the Info.plist? Are there any other settings that I should check? Is the warning spurious and something that I should ignore (after raising a Radar)?

推荐答案

为iOS编译资产目录时6和更低,图像被放在应用程序包的根目录中,就好像你只是以旧方式复制它们一样。发生这种情况时,Apple会根据资产名称而不是文件名来命名图像,这意味着我们仍然可以使用 + [UIImage imageNamed:] 来获取iOS上的资产6,及更低。

When an asset catalog is compiled for iOS 6 and lower, the images are put in the root of the app bundle, as if you were just copying them the old way. When this happens, Apple names the images according to the asset name, rather than the filename, which means we can still use +[UIImage imageNamed:] to get the assets on iOS 6 and lower.

当我们的资产目录中设置了以下图标时,App Icon资产就是如此:

This is true for the App Icon asset, when we have the following icons set in our asset catalog:

它们编译成如下:

由于iOS 6仍然是iOS 6,因此必须在Info.plist中引用这些文件,否则现有系统将无法运行。查看此测试应用程序的已编译Info.plist,您会看到Xcode为我们添加了 CFBundleIconFiles ,因此我们不需要。

As iOS 6 is still iOS 6, these files must be referenced in the Info.plist, otherwise the existing system wouldn't work. Looking in the compiled Info.plist for this test app, you see that Xcode has added CFBundleIconFiles for us and so we don't need to.

我上传了以前用于 github.com/danielctull-tests/AssetTest 的测试项目。

I have uploaded the test project I used to github.com/danielctull-tests/AssetTest.

这篇关于图标,资产目录和Info.plist混淆的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆