Ok so i'm pulling my teeth out over this one and I sincerely hope i've made a stupid mistake (there have been some late nights involved).
Short back story, we are building a product that needs to be brand-able as multiple customers will share 90% the same UI and code, with some config options to turn things on / off and different colours, fonts and images etc.
All working fine except the .xcassets folders. I have 1 per customer, currently they have the same asset names, with different images. For example, each .xcassets has a ic_settings
, but the contents are different for each.
I've checked the copy bundle resources build phase and for each target, it does in fact only have 1 of the .xcasset folders for each.
<redacted image>
<redacted image>
When I run the app, it correctly loads the appIcon (which I had to rename to appIcon-<target>
, because the drop down in Xcode was showing them all and had no way to know which was which). It also displays the correct bundle name and launch screen.xib.
Below are the images themselves. As you can see the images are quite different:
<redacted image>
<redacted image>
But When I run customer 1 and customer 2. All the images are customer 1's.
I don't know how this is physically possible, please tell me:
- I'm not insane
- I've made some simple mistake I just can't see
- This isn't an Xcode bug and will not require the most over elaborate work around man kind has ever seen. Possibly renaming all images to append the target name as well :-(.
Note
I have tried cleaning, building, reseting simulator, deleting derived data etc. Both on simulator and real device.
If I add a unique image to one of the folders, I am able to use it. Gut feeling is that Xcode is merging the folders????
Workaround
Marked answer is correct, it was cocoapods. This is a known issue and currently the best workaround (i've found), is to use this: https://github.com/CocoaPods/CocoaPods/issues/1546#issuecomment-61907975