actool generates files which crash on iOS <9.3

Originator:rmalik
Number:rdar://44736684 Date Originated:9/24/2018
Status:Open Resolved:
Product:Developer Tools | Xcode Product Version:10.0 GM
Classification: Reproducible:
 
Summary:
When we were testing Pinterest for iOS 12, we noticed a regression when running the build on older devices / OS versions. The current version of actool (with Xcode 10 GM) generates an Assets.car file which crashes when the first image is read from it on iOS versions earlier than 9.3.

As a result we have had to move our minimum deployment target from 9.0 to 9.3 to avoid impacting our users.

Steps to Reproduce:
Build an iOS application with an asset catalog on Xcode 10 and run that on iOS 9.2

Expected Results:
The application should function normally when trying to display an image from the asset catalog.

Actual Results:
The application crashes immediately for all users when they access an image from the asset catalog.

Version/Build:
```
[I] ⋊> ~/Desktop xcodebuild -version                                                         12:52:47
Xcode 10.0
Build version 10A254a
```

Configuration:
  Operating System: macOS High Sierra
  Model Name:	iMac
  Model Identifier:	iMac17,1
  Processor Name:	Intel Core i7
  Processor Speed:	4 GHz
  Number of Processors:	1
  Total Number of Cores:	4
  L2 Cache (per Core):	256 KB
  L3 Cache:	8 MB
  Memory:	32 GB
  SMC Version (system):	2.34f2

Preliminary Investigation / Extra Information:

*Schema Changes* 
I tried to debug what had changed myself by running `xcrun --sdk iphoneos assetutil --info Assets.car` and have attached the results for Xcode 9.3 and Xcode 10 GM. The notable differences for me were duplicate entries for most image and also the addition of the key `DeploymentTarget` with the value `2018`. I'm assuming there was a change to the format that is either not backwards compatible or that previous versions were strict about the schema that they were expecting.

In addition these are the following new keys that are included in the format
- "kCRThemeAppearanceName"
- "kCRThemeSubtypeName"
- "kCRThemeDeploymentTargetName"


I would love to debug further but since actool is closed source it's hard for me to continue without trying to disassemble the binary to inspect further.  Let me know if you need any more information that would be helpful.

Other Resources:
Here are links to other people that have encountered this issue. Unfortunately some of them have impacted their users with this regression.
https://twitter.com/igorbaum/status/1043236631921283072
https://twitter.com/apontious/status/1044288765441728513
https://twitter.com/Javi/status/1043513269871235073

Comments


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!