How to resolve assets error in Xcode 8

Recently I started seeing this error:

Invalid Bundle – The asset catalog at ‘Payload/XXXXX/Assets.car’ can’t contain 16-bit or P3 assets if the app supports iOS 8 or earlier

When I saw it in my own app I just changed the deployment target to iOS 9.3. Next time I saw this error in the project that I do on my job. This time the client wanted to keep supporting iOS 8.0 so I had to find another solution. After googling for some time I found the solution here.

The rest of the post is just a copy-paste. I need it here on my site, so I don’t have to look for it again later.

1. Create an Inspectable .ipa file.  In the Xcode Organizer (Xcode->Window->Organizer), select an archive to inspect, click “Export…”, and choose “Export for Enterprise or Ad-Hoc Deployment”. This will create a local copy of the .ipa file for your app.

2. Locate that .ipa file and change its the extension to .zip.

3. Expand the .zip file. This will produce a Payload folder containing your .app bundle.

4. Open a terminal and change the working directory to the top level of your .app bundle

cd path/to/Payload/your.app

5. Use the find tool to locate Assets.car files in your .app bundle as shown below:

find . -name ‘Assets.car’

6. Use the assetutil tool to find any 16-bit or P3 assets, in each Assets.car your application has as shown below. :

sudo xcrun –sdk iphoneos assetutil –info /path/to/a/Assets.car > /tmp/Assets.json

7.  Examine the resulting /tmp/Assets.json and look for any contents containing “DisplayGamut”: “P3” and its associated “Name”.  This will be the name of your imageset containing one or more 16-bit or P3 assets.

8.  Replace those assets with 8-bit / sRGB assets, then rebuild your app.

Update:  If your Deployment Target is set to either 8.3 or 8.4 and you have an asset catalog then you will receive this same error message, even if you do not actually have 16-bit or P3 assets.  In this case you will either need to lower your Deployment Target to 8.2, or move it up to 9.x.

[SW]

Facebooktwitterredditpinterestlinkedinmail

Leave a Reply

Your email address will not be published. Required fields are marked *