xcode 命令 CompileAssetCatalog 失败,退出代码非零
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/52489500/
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
Command CompileAssetCatalog failed with a nonzero exit code
提问by Michael Ansell
Running Xcode 10 and can not seem to find much information on this error that occurs when building my project.
运行 Xcode 10 并且似乎无法找到有关构建我的项目时发生的此错误的太多信息。
Any ideas on how to fix this?
有想法该怎么解决这个吗?
Here is the last line before the error:
这是错误前的最后一行:
Desktop/CheerApp!/CheerApp!/Assets.xcassets Command CompileAssetCatalog failed with a nonzero exit code –
Desktop/CheerApp!/CheerApp!/Assets.xcassets 命令 CompileAssetCatalog 失败,退出代码非零 –
Expanded:
展开:
CompileAssetCatalog /Users/michaelansell/Library/Developer/Xcode/DerivedData/CheerApp!-ehbjnqaldsycfegiviymewkplqhm/Build/Products/Debug-iphonesimulator/CheerApp!.app /Users/michaelansell/Desktop/CheerApp!/CheerApp!/Assets.xcassets (in target: CheerApp!) cd /Users/michaelansell/Desktop/CheerApp! /Applications/Xcode.app/Contents/Developer/usr/bin/actool --output-format human-readable-text --notices --warnings --export-dependency-info /Users/michaelansell/Library/Developer/Xcode/DerivedData/CheerApp!-ehbjnqaldsycfegiviymewkplqhm/Build/Intermediates.noindex/CheerApp!.build/Debug-iphonesimulator/CheerApp!.build/assetcatalog_dependencies --output-partial-info-plist /Users/michaelansell/Library/Developer/Xcode/DerivedData/CheerApp!-ehbjnqaldsycfegiviymewkplqhm/Build/Intermediates.noindex/CheerApp!.build/Debug-iphonesimulator/CheerApp!.build/assetcatalog_generated_info.plist --app-icon AppIcon --compress-pngs --enable-on-demand-resources YES --optimization space --filter-for-device-model iPhone11,2 --filter-for-device-os-version 12.0 --sticker-pack-identifier-prefix Mike.CheerApp-.sticker-pack. --target-device iphone --target-device ipad --minimum-deployment-target 11.4 --platform iphonesimulator --product-type com.apple.product-type.application --compile /Users/michaelansell/Library/Developer/Xcode/DerivedData/CheerApp!-ehbjnqaldsycfegiviymewkplqhm/Build/Products/Debug-iphonesimulator/
CompileAssetCatalog /Users/michaelansell/Library/Developer/Xcode/DerivedData/CheerApp!-ehbjnqaldsycfegiviymewkplqhm/Build/Products/Debug-iphonesimulator/CheerApp!.app /Users/michaelansell/Desktop/CheerApp!/CheerApp!/CheerApp!/CheerApp!/CheerApp! : CheerApp!) cd /Users/michaelansell/Desktop/CheerApp! /Applications/Xcode.app/Contents/Developer/usr/bin/actool --output-format human-readable-text --notices --warnings --export-dependency-info /Users/michaelansell/Library/Developer/Xcode/ DerivedData/CheerApp!-ehbjnqaldsycfegiviymewkplqhm/Build/Intermediates.noindex/CheerApp!.build/Debug-iphonesimulator/CheerApp!.build/assetcatalog_dependencies --output-partial-info-plist /Users/michaelansell/Library/Developer/Data CheerApp!-ehbjnqaldsycfegiviymewkplqhm/Build/Intermediates.noindex/CheerApp!.build/Debug-iphonesimulator/CheerApp! .build/assetcatalog_generated_info.plist --app-icon AppIcon --compress-pngs --enable-on-demand-resources 是 --优化空间 --filter-for-device-model iPhone11,2 --filter-for-device -os-version 12.0 --sticker-pack-identifier-prefix Mike.CheerApp-.sticker-pack。--target-device iphone --target-device ipad --minimum-deployment-target 11.4 --platform iphonesimulator --product-type com.apple.product-type.application --compile /Users/michaelansell/Library/Developer/ Xcode/DerivedData/CheerApp!-ehbjnqaldsycfegiviymewkplqhm/Build/Products/Debug-iphonesimulator/
回答by Jmf
I managed to resolve this by doing a "build clean", removing "DerivedData" folder and re-starting my Mac.
我设法通过执行“构建清理”、删除“ DerivedData”文件夹并重新启动我的 Mac来解决此问题。
回答by User123335511231
It seems that this occurs if you change one of the images opened from the Assets. Here are some solutions that worked:
如果您更改从资产打开的图像之一,似乎会发生这种情况。以下是一些有效的解决方案:
- Run the app on a different simulator
- Clean(both CMD+SHIFT+K and CMD+ALT+SHIFT+K)
- Re-add the Assetsinto the project
- RestartMac
- JOKE: Restart the electric power plant
- 在不同的模拟器上运行应用程序
- 清洁(CMD+SHIFT+K 和 CMD+ALT+SHIFT+K)
- 将资产重新添加到项目中
- 重启Mac
- 笑话:重启发电厂
回答by Linus
Try removing and then re-adding at least some of the images you're using. That did it for me at least.
尝试删除然后重新添加至少一些您正在使用的图像。至少对我来说是这样。
This seems to be a bug in the Xcode 10.1
这似乎是 Xcode 10.1 中的一个错误
回答by Sungwook Kim
All of answers don't work for me. What solved and found by me is getting better Xcode like Xcode11 beta5 or Xcode10.3 stable and installing it and then Shift-Command-K to clean the project.
所有的答案都不适合我。我解决并发现的是让 Xcode 变得更好,例如 Xcode11 beta5 或 Xcode10.3 稳定并安装它,然后使用 Shift-Command-K 来清理项目。
And recompiling the project with new Xcode version solved the problem.
用新的 Xcode 版本重新编译项目解决了这个问题。
回答by Leemur
I found the same error related to the Launch Images.
我发现与启动图像相关的相同错误。
My solution:
我的解决方案:
In the main project settings go to:
在主项目设置中转到:
- Tab: General
- Section: App Icons and Launch Images
- Option: Launch Images Source
- 标签:一般
- 部分:应用程序图标和启动图像
- 选项:启动图像源
Remove the link to the asset catalog, and clean the build folder with CMD+SHIFT+K.
删除指向资产目录的链接,并使用 CMD+SHIFT+K 清理构建文件夹。
Voilà!
瞧!
You can link it later again.
您可以稍后再次链接它。
回答by Connor Chappell
In my case, the .xcassets file's target membership was unchecked for some reason. All I had to do was re enable it for the target I was working on and it fixed the error.
就我而言,.xcassets 文件的目标成员资格由于某种原因未选中。我所要做的就是为我正在处理的目标重新启用它并修复了错误。
回答by Ananta Prasad
In Xcode 10 Go to Product>Clean Build Folder
在 Xcode 10 中转到 Product>Clean Build Folder
or
或者
User Short cut as Shift+Command+K
用户快捷键为 Shift+Command+K
After that make run it will work, it worked in my case.
在那之后 make run 它将起作用,它在我的情况下起作用。
回答by Prasad Parab
I also had the same issue on Xcode 10. Tried everything but nothing worked. Just out of curiosity tried compiling my project in Xcode 9.4and it failed again but this time it gave me a valid error. In my case it was because of no images in the launch image assets and the project being an old one had launch images instead of launch screen storyboard. Would recommend to try the project in lower Xcodes of available.
我在Xcode 10上也遇到了同样的问题。尝试了一切,但没有任何效果。出于好奇,我尝试在Xcode 9.4 中编译我的项目,但它再次失败,但这次它给了我一个有效的错误。就我而言,这是因为启动图像资产中没有图像,并且项目是旧的,只有启动图像而不是启动屏幕故事板。建议在可用的较低 Xcode 中尝试该项目。
回答by Jeff Nelson
Did you copy an assets folder into your Xcode project? If so you might have 2 and need to erase the old one.
您是否将资产文件夹复制到您的 Xcode 项目中?如果是这样,您可能有 2 个并且需要擦除旧的。
回答by Abhishek Mishra
I also faced same issue and I follow these steps :
我也遇到了同样的问题,我按照以下步骤操作:
1- Remove Reference
Assets.xcassets
folder.
1-Remove Reference
Assets.xcassets
文件夹。
2- Clean(both CMD+SHIFT+K and CMD+ALT+SHIFT+K).
2- 清洁(CMD+SHIFT+K 和 CMD+ALT+SHIFT+K)。
3- Build(CMD+B).
3-构建(CMD+B)。
4- Add your Assets.xcassets
folder.
4- 添加您的Assets.xcassets
文件夹。
5- Follow steps 2 & 3 again.
5- 再次执行步骤 2 和 3。