I have one app that has 2 variations that only differ in branding. For each version I have an AppIcon and LaunchImage in an asset catalog. I've created a different target for each version. In the second version when I try and select AppIcon in the second asset catalog it just defaults to the first one. Removing the first asset catalog seems to resolve it but I would prefer a less 'hacky' solution.
After much frustration, I have clean, successful, separate images assets. Here's what worked for me:
I used XCode to create an image catalog for the first target (File, New, File, Asset). It has a membership for that target only. As Mark Horgan suggested, I named the internal appIcon & launchImages, if only to make it easier for myself.
Next, I deleted that catalog from my project using the option to remove references.
I repeated step 1 and created an image catalog for the 2nd target. It has a membership for that 2nd target only. Assigning the catalog to my target was tricky because XCode only offered "Don't Use Image Catalog" as an option. I choose that option, and then XCode offers "Use Asset Catalog". I chose my new catagot. Again I named the internal appIcon & launchImages to reference the 2nd target, so I could recognize it.
As in 2, I removed the catalog with a remove references delete.
Departing XCode for a moment, I opened a Finder window and located my two different images.xcassets files which had been put in different directories by XCode. I renamed those files to each reference their target. (I also moved them into the master folder, but of course that's a preference.)
Back in XCode, I (re)added the xcassets files, one at a time, ensuring they were appropriately added to their target and copied to resources.
Then in XCode I selected each target and used the General tab to properly specify the image catalog for each target.
I think the best solution I've come up with so far is to rename assets in subsequent asset catalogs. For example you might have 2 asset catalogs that contain assets named AppIcon and LaunchImage. In the 2nd asset catalog I've renamed AppIcon and LaunchImage to AppIcon1 and LaunchImage1. So now I can select them in the 'General' section of the target's build settings.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With