xcode 缺少必需的图标文件。该捆绑包不包含精确为“120x120”像素的 iPhone/iPod Touch 应用程序图标

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/43942787/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-15 09:58:13  来源:igfitidea点击:

Missing required icon file. The bundle does not contain an app icon for iPhone / iPod Touch of exactly '120x120' pixels

iosiphonexcodeapp-store-connect

提问by Snowcrash

My recent App Store upload gave me this error:

我最近上传的 App Store 给了我这个错误:

iTunes Store operation failed.
Missing required icon file. The bundle does not contain an app icon for iPhone / iPod Touch of exactly '120x120' pixels, in .png format for iOS versions >= 7.0.

I've added a 120 pixel icon file with the names "Icon-120.png" and "[email protected]" and checked it's being added in the Build Phases > Copy Bundle Resources but I am still getting the same error.

我添加了一个名为“Icon-120.png”和“[email protected]”的 120 像素图标文件,并检查它是否被添加到构建阶段 > 复制捆绑资源中,但我仍然遇到相同的错误.

Any suggestion what else I can try to solve this?

有什么建议我还能尝试解决这个问题吗?

If it helps I've been working my way through this very lengthy SO answer: 'Missing recommended icon file - The bundle does not contain an app icon for iPhone / iPod Touch of exactly '120x120' pixels, in .png format'but yet to get to the bottom of this.

如果它有帮助,我一直在解决这个非常冗长的 SO 答案:“缺少推荐的图标文件 - 捆绑包不包含 .png 格式的 iPhone/iPod Touch 应用程序图标”,但尚未包含精确的“120x120”像素深入了解这一点。

Also, I've done a Build > Clean and restarted Xcode.

另外,我已经完成了 Build > Clean 并重新启动了 Xcode。

====

====

$ file Icon-120.png 
Icon-120.png: PNG image data, 120 x 120, 8-bit/color RGBA, non-interlaced
$ file Icon-60\@2x.png 
[email protected]: PNG image data, 120 x 120, 8-bit/color RGBA, non-interlaced

回答by Matt Hudson

For Xcode 9 on High Sierra try this:

对于 High Sierra 上的 Xcode 9,试试这个:

  1. Go to Menu Product > Archive, right click on your new build > Show in Finder.
  2. Open Terminal and change to Archive: (type cd + space, drag your new build *.xcarchive

    cd /Users/[user]/Library/Developer/Xcode/Archives/[XXX].xcarchive  
    
  3. Using @stubyte's code:

    find Products/ -name Info.plist -print0 | xargs -0n1 plutil -replace BuildMachineOSBuild -string 16A323
    
  4. Go back to Xcode > Windows > Organizer > Upload to App Store...

  1. 转到菜单产品 > 存档,右键单击您的新版本 > 在 Finder 中显示。
  2. 打开终端并更改为存档:(键入 cd + space,拖动您的新构建 *.xcarchive

    cd /Users/[user]/Library/Developer/Xcode/Archives/[XXX].xcarchive  
    
  3. 使用@stubyte 的代码:

    find Products/ -name Info.plist -print0 | xargs -0n1 plutil -replace BuildMachineOSBuild -string 16A323
    
  4. 返回 Xcode > Windows > Organizer > Upload to App Store...

Fixed:

固定的:

ERROR ITMS-90022: "Missing required icon file. The bundle does not contain an app icon for iPhone / iPod Touch of exactly '120x120' pixels, in .png format for iOS versions >= 10.0."

ERROR ITMS-90023: "Missing required icon file. The bundle does not contain an app icon for iPad of exactly '167x167' pixels, in .png format for iOS versions supporting iPad Pro."

ERROR ITMS-90023: "Missing required icon file. The bundle does not contain an app icon for iPad of exactly '152x152' pixels, in .png format for iOS versions >= 10.0."

错误 ITMS-90022:“缺少必需的图标文件。该捆绑包不包含适用于 iPhone/iPod Touch 的应用程序图标,其像素正好为“120x120”,适用于 iOS 版本 >= 10.0 的 .png 格式。”

错误 ITMS-90023:“缺少必需的图标文件。该捆绑包不包含适用于 iPad 的应用程序图标,该图标为 .png 格式,适用于支持 iPad Pro 的 iOS 版本,且像素正好为‘167x167’像素。”

错误 ITMS-90023:“缺少必需的图标文件。该捆绑包不包含适用于 iPad 的应用程序图标,其像素正好为“152x152”,适用于 iOS 版本 >= 10.0 的 .png 格式。”

Still warning

仍然警告

WARNING ITMS-90704: "Missing Marketing Icon. iOS Apps must include a 1024x1024px Marketing Icon in PNG format. Apps that do not include the Marketing Icon cannot be submitted for App Review or Beta App Review."

警告 ITMS-90704:“缺少营销图标。iOS 应用程序必须包含一个 1024x1024 像素的 PNG 格式营销图标。不包含营销图标的应用程序无法提交进行应用程序审核或 Beta 版应用程序审核。”

This temporary solution is working for me.

这个临时解决方案对我有用。

回答by Huang Huang

If you use xcode 9, maybe try this. Find xcarchive file, execute this command.

如果您使用 xcode 9,不妨试试这个。找到xcarchive文件,执行这个命令。

find Products/ -name Info.plist -print0 | xargs -0n1 plutil -replace BuildMachineOSBuild -string 16A323

find Products/ -name Info.plist -print0 | xargs -0n1 plutil -replace BuildMachineOSBuild -string 16A323

Visit developer sitestubyte`s answer.

访问开发者网站stubyte 的回答。

回答by l'L'l

Since you mentioned the icon filename is not in the Info.plistyou'll want to add:

由于您提到图标文件名不在Info.plist您要添加的中:

<key>CFBundleIconFiles</key>
<array>
    <string>Icon-120.png</string>
</array>

It appears to be required now in order to associate the icon(s) with your app.

现在似乎需要将图标与您的应用程序相关联。

回答by Eran Talmor

In the "General" view, inside the "App Icons and Launch Images" section, make sure that "Apps Icons Source" is linked with the "Images.xcassets" file.

在“ General”视图中的“ App Icons and Launch Images”部分,确保“ Apps Icons Source”与“ Images.xcassets”文件相关联。

回答by Emil ?sterg?rd Johansen

In my case, for some reason the AppIcon asset was not part of the app target. Checking this checkbox solved the problem:

就我而言,由于某种原因 AppIcon 资产不是应用程序目标的一部分。选中此复选框解决了问题:

enter image description here

在此处输入图片说明

回答by Andrew Duncan

If you are using an images.xcassetsfile, be sure it is included in the Build Phases > Copy Bundle Resources list. I inherited a project that did not use this, migrated to use this file for App Icon, but did not add it to the Copy Bundle Resources list. Now, you would expect a better error message, but this fixed the problem. (So did editing the plist file as per Sahil above citing stubyte.)

如果您正在使用一个images.xcassets文件,请确保它包含在 Build Phases > Copy Bundle Resources 列表中。我继承了一个没有使用这个的项目,迁移到App Icon使用这个文件,但是没有将它添加到Copy Bundle Resources列表中。现在,您希望得到更好的错误消息,但这解决了问题。(根据上面引用 stubyte 的 Sahil 编辑 plist 文件也是如此。)

回答by John Guy

Another Simple Fix once discovered:

曾经发现的另一个简单修复:

I had a similar issue with XCode 9.0, a project that worked perfectly well under XCode 8 and iOS 10 suddenly loses it's icons (only on iPads) when I upgraded the solution.

我在 XCode 9.0 上遇到了类似的问题,当我升级解决方案时,一个在 XCode 8 和 iOS 10 下运行良好的项目突然丢失了它的图标(仅在 iPad 上)。

Tore my hair out, did the sRGB thing, did the Transparency thing.

撕掉我的头发,做了 sRGB 的事情,做了透明的事情。

Turns out I still had the following empty entry in my targets info.plist file

结果我的目标 info.plist 文件中仍然有以下空条目

CFBundleIcons~ipad

CFBundleIcons~ipad

I'd long ago moved to specifying this in the target build settings.

我很久以前就开始在目标构建设置中指定它。

The solution was to simply remove this entry from the info.plist file (clicked the helpful little "-" button. Rebuilt and tested and everything was perfect once more.

解决方案是简单地从 info.plist 文件中删除此条目(单击有用的小“-”按钮。重新构建和测试,一切再次完美。

回答by javifernandezr

If you have added all icons files to the "images.xcassets", it could be possible that you have forgotten check the "Target Membership" in the right panel of Xcode.

如果您已将所有图标文件添加到“images.xcassets”,您可能忘记检查 Xcode 右侧面板中的“Target Membership”。

You will can to clean your project, archive it and send it to iTunesConnect.

您可以清理您的项目,将其存档并将其发送到 iTunesConnect。

回答by Rajan Balana

I was able to resolve the issue by copying the below-given code in PodFile.

我能够通过在 PodFile 中复制下面给出的代码来解决这个问题。

post_install do |installer|
  copy_pods_resources_path = "Pods/Target Support Files/Pods-PROJECT_NAME/Pods-PROJECT_NAME-resources.sh"
  string_to_replace = '--compile "${BUILT_PRODUCTS_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}"'
  assets_compile_with_app_icon_arguments = '--compile "${BUILT_PRODUCTS_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" --app-icon "${ASSETCATALOG_COMPILER_APPICON_NAME}" --output-partial-info-plist "${BUILD_DIR}/assetcatalog_generated_info.plist"'
  text = File.read(copy_pods_resources_path)
  new_contents = text.gsub(string_to_replace, assets_compile_with_app_icon_arguments)
  File.open(copy_pods_resources_path, "w") {|file| file.puts new_contents }
end

Let me know, if this works for you.

如果这对你有用,请告诉我。

回答by Uwe

Just had same problem. Using Xcode 8.3.3 and wanted to use AppIcon in Assests catalogue. Tried all sorts of Stack Overflow answers without success.

刚刚有同样的问题。使用 Xcode 8.3.3 并想在资产目录中使用 AppIcon。尝试了各种 Stack Overflow 的答案,但没有成功。

Finally learned about a deep clean step from Ken/Apple Forum:

终于从 Ken/Apple 论坛了解到了一个深度清理步骤:

  • removed all icon files, whether from resources (delete - trash) or appicon file (select - remove selected items); removed even assets folder
  • deep cleaned (Use the Product menu w/option key pressed, then choose to 'clean build folder')
  • added a new asset catalogue and called it "Assets" right clicked in Assets folder and added new app icon set - changed that one in inspector to be for iOS >=7
  • triple checked all my icon files OUTSIDE of Xcode (all were already png files of right resolution, but some had still colour profile attached from photoshop elements or did have indexed colour instead of RGB profile. so I made sure I only save a png file without colour profile and from a background layer) - not sure that was necessary
  • archived the build from Product menu
  • validated and uploaded the build from Window - Organizer
  • 删除所有图标文件,无论是从资源(删除 - 垃圾箱)还是 appicon 文件(选择 - 删除所选项目);删除偶数资产文件夹
  • 深度清理(使用产品菜单,按下选项键,然后选择“清理构建文件夹”)
  • 添加了一个新的资产目录并将其命名为“资产”,在资产文件夹中右键单击并添加新的应用程序图标集 - 在检查器中将其更改为 iOS >=7
  • 三重检查了我在 Xcode 之外的所有图标文件(所有的图标文件都已经是正确分辨率的 png 文件,但有些仍然从 photoshop 元素附加了颜色配置文件,或者确实有索引颜色而不是 RGB 配置文件。所以我确保我只保存一个没有颜色配置文件和背景层) - 不确定这是必要的
  • 从产品菜单归档构建
  • 从 Window - Organizer 验证并上传构建