51

Does anybody know why this error happens on Xcode 5?

error

Answer

I had this problem when I accidentally renamed a .psd as a .png. Converting the image to an actual png instead of a Photoshop file fixed it for me.

Iulian Onofrei
  • 9,188
  • 10
  • 67
  • 113
Jun
  • 3,422
  • 3
  • 28
  • 58
  • I did the exact same thing. Thanks! – Gary Johnson Apr 04 '14 at 14:59
  • I have done the same! Thanks Harry, I would definitely spent a lot of time figuring it out. – Andrew Slabko Oct 08 '15 at 14:07
  • Did this only happen for you when archiving? Did for me. Build and run worked fine, but I only ran into this issue when attempting to archive. – T Blank Oct 28 '15 at 01:42
  • you can look at your log files, to find the one that failed, that's the fastest way to solve the problem, you'll see an error like this: CoreThemeDefinition: Unable to create image for file:///.../imageset/attach_voice_down.png /* com.apple.actool.errors */ – ReduxDJ Jun 11 '16 at 06:36
  • Ran into a similar issue using Git LFS – Ryan Cortez Dec 05 '16 at 18:44
  • PNG files misnamed with .jpg seem to have been the cause for my CompileAssetCatalog failure, too. – Andrew Moore Jun 16 '21 at 21:29

19 Answers19

48

I found that my png was a psd file. I deleted the file and recreated a new png and everything was fine.

grgr

Karsten
  • 1,869
  • 22
  • 38
  • Same here, the extension was 'png' but I accidentally saved the file as psd type. Shame Xcode doesn't identify the specific file with the problem, takes some trial and error to narrow it down. – Craig Grummitt Oct 20 '15 at 20:30
  • Important Note: Preview and Xcode will treat your fake PNG just like a normal PNG. One of my tvOS app icon layers happened to be a PSD masquerading as a PNG, and it was way harder to track down than I thought it would be. So when testing your PNG assets, you **must attempt to open them in Photoshop**, not just in Preview. Your app will build and UIImage will work with your PSD that's been named *.png JUST FINE. I really wish it wouldn't. – T Blank Oct 28 '15 at 01:40
  • 2
    @Harry Not sure what your point is. It still helped other people (including me) – DardanM Apr 07 '16 at 18:12
  • just arrived on a project, migrated to xcode 8, got this error, and looked at the 100 x 3 assets present in the xcasset file... what a good day. – Martin Aug 29 '16 at 14:25
  • In Terminal, you can do `file filename.png` to check the type. I also used `file */*` in the root of the `*.xcassets` directory to check all the files in the group. – RyanJM Sep 18 '18 at 00:23
13

I had the same case as Karsten, one of the image was psd. I opened the file in Mac Preview app and tried to export and found that it was a PSD instead of .png enter image description here

naveed148
  • 548
  • 5
  • 8
10

You might have migrated from a normal project to use an image.catalog. So you can definitely try to copy the bundle resource like launch images. It is so because migrating to an asset catalog for icons and launch images apparently doesn't always add itself to the target automatically.

You can find more on this here & here.

I hope that helps.

Community
  • 1
  • 1
Balram Tiwari
  • 5,657
  • 2
  • 23
  • 41
4

For me, I used with Xcode beta but I didn't upgrade my MAC OSX beta to the latest version as Apple recommends.

enter image description here.

evya
  • 3,381
  • 1
  • 25
  • 28
4

In my case I just forgot to initialize Git LFS for my repo.

3

In my case, one of the image asset is corrupted and caused this issue.

Corrupted image usually with 0 (zero) size. so, we can use terminal to find out which one:

find ./your_directory_path -size 0 -print

Joni
  • 3,039
  • 2
  • 15
  • 10
3

For me the solution was to do the following (given I had no .psd as .png, etc.).

Go to the General tab of the Target in Xcode project settings, roll down to the "App Icons and Launch Images" section, and change the value of "App Icons Source" from "AppIcon" to "Don't use asset catalogs"

Note: this way the project builds and deploys on iOS, and later you can change the AppIcon settings back, adding your custom AppIcon (with proper file-format and file-extension).

Community
  • 1
  • 1
3

In my case it was a PSD file saved as PNG. You can search for wrong files by running following command in Terminal in your assets directory:

grep -rL "PNG" --include \*.png . 
krzysztof
  • 411
  • 4
  • 3
3

Xcode 11: I just removed Assets.xcassets and re-added to target, and it worked.

Mohammad Zaid Pathan
  • 16,304
  • 7
  • 99
  • 130
3

I had the same error and it is because I forgot initializing Git LFS. So the png files are not pulled

MortyXiong
  • 31
  • 1
  • 1
1

Update or ensure minimum version is: Mac OS CATALINA BETA 10.15 beta (19A536g) and Xcode Version 11.0 beta 5 (11M382q)

After talking with an apple engineer, the problem was solved by updating MAC OS and Xcode, specifically to these versions I assure that the problem was solve.

Gus
  • 11
  • 2
  • Thanks for the response. On `10.15 beta 19A471t` with xcode `11.3.1 11C505` the bug exists. Just adding one png icon to the assets it fails the build. – Odys Dec 13 '20 at 12:27
1

If you hit this error, as a workaround, try removing all the images in you Images.xcassets from their placeholders and build the project again. Assuming the project builds without any images in place, which was the case for me, start re-adding images back one by one, starting from the bottom (App Store, iPad etc.) building project after each addition. This will help you isolate placeholders that cause the error.

In my case: the set of icons that comes with cocos2d-x project, the problem doesn't seem to be with a particular image, but with placeholder it is placed in. In particular, it seems to give an error on all placeholders whose name includes "iPhone". I can successfully build the project with all non-iPhone placeholders filled, but as soon as I move an image from say iPad placeholder to a compatible iPhone placeholder (e.g. iPad Notifications 20pt@2x to iPhone Notification 20pt@2x) the project fails with the above mentioned error.

I'm on the latest (as of right now) MacOS Catalina 10.15 Beta (19A487l) and the latest Xcode 11.3.1 (11C504), but I still hit this error, so the suggestions about to update to the latest won't necessarily work. The command line in both cases is:

/Applications/Xcode.app/Contents/Developer/usr/bin/actool --output-format human-readable-text --notices --warnings --export-dependency-info /Users/me/Library/Developer/Xcode/DerivedData/MyProject-eiofgcnvwliyntcmqdepcocwffyk/Build/Intermediates.noindex/MyProject.build/Debug-iphoneos/MyProject-mobile.build/assetcatalog_dependencies --output-partial-info-plist /Users/me/Library/Developer/Xcode/DerivedData/MyProject-eiofgcnvwliyntcmqdepcocwffyk/Build/Intermediates.noindex/MyProject.build/Debug-iphoneos/MyProject-mobile.build/assetcatalog_generated_info.plist --app-icon AppIcon --enable-on-demand-resources YES --filter-for-device-model iPhone10,6 --filter-for-device-os-version 13.3.1 --sticker-pack-identifier-prefix com.example.app.ios.sticker-pack. --development-region English --target-device iphone --target-device ipad --minimum-deployment-target 12.1 --platform iphoneos --product-type com.apple.product-type.application --compile /Users/me/Library/Developer/Xcode/DerivedData/MyProject-eiofgcnvwliyntcmqdepcocwffyk/Build/Products/Debug-iphoneos/MyProject-mobile.app /Users/me/Projects/Cocos/MyProject/proj.ios_mac/ios/Images.xcassets

solodon
  • 516
  • 5
  • 7
1

In my case, there is a invalid png image in Assets.xcassets.

nathanwhy
  • 5,884
  • 1
  • 12
  • 13
0

I was prompted this error and I inspect error logs.

PrefixIcons.xcassets/PrefixButtonBackground.imageset/PrefixButtonBackground.png
/* com.apple.actool.errors */
: error: Distill failed for unknown reasons.

The reason was.

I have mistakenly added same image for 1x and 2x sizes for above given image.

Might be helpful to someone.

MadNik
  • 7,713
  • 2
  • 37
  • 39
0

it happen for me with xcode 7.3 when i was replace an insert and image with the same name in the folder (in finder screen)

so i just rename remove the image form assets and insert it gain with a different name clean + build and it works fine

Amr Angry
  • 3,711
  • 1
  • 45
  • 37
0

My image names that contained "ç" or that end with "é" caused the problem. Renaiming it and cleaning the project did the trick! Odly this naming worked on xcode 10 but no more on 11.1

glemoulant
  • 517
  • 7
  • 18
0

I faced this error on Xcode_11.1 and completely wasted my whole week. then I realize it was Xcode itself bug, I tried many of the above answers but no luck.

to make sure it's Xcode bug just simply empty the asset folder the try to build with empty folder if errors still exist then downgrade or upgrade to another version my working version was Xcode_10.2.1

Hope it helps

Payam Khaninejad
  • 7,692
  • 6
  • 45
  • 55
0

I deleted the Assets.xcassets folder in my Runner folder of ios To be more specific

  1. Ios==>> Runner ==>> Assets.xcassets deleted.
  2. then paste previous Assets.xcassets file here Then it was working fine.
-1

After investing like 6-7 hours on this,I checked same project on MacOS Mojave - 10.14.6(18G103)and it was working fine but it was not working on MacOS Catalina Beta Version. After investigating, i updated the MacOS to the latest Catalina Beta Version and it was working fine.

  • It would be helpful if you provided some more specific info on how you updated the latest xcode. between which two versions did you do the update? – CEH Oct 01 '19 at 16:15