5

I've created different Targets in my Xcode project to version my app for different clients. Each client uses different xcassets, one for each target. This way I can have different images with the same names. So just by selecting the target, the correct image will show.

This works for any view in my app. Whenever I run the app in a different target, all the images change automatically. The problem is when I have an image in my Launch Screen. I created .xib files for my Launch Screen (one for each client).

By selection the target, the correct .xib runs, but the image that it loads is always the same from the base project.


This is how I organised the project so having different targets would automatically pick different images:

  • Base.xcassets:
    1. Target Membership = Base
    2. image-launch (base project launch screen)
    3. Other images for base project
  • Client1.xcassets:
    1. Target Membership = Client1
    2. image-launch (client 1 version launch screen)
    3. Other images for client 1 version
  • Client2.xcassets:
    1. Target Membership = Client2
    2. image-launch (client 2 version launch screen)
    3. Other images for client 2 version

When I select a target, all elements with that Target Membership should be loaded. Only my Launch Screen loads the image-launch from the Base.xcassets.

Cœur
  • 37,241
  • 25
  • 195
  • 267
CFlux
  • 346
  • 4
  • 9
  • You sure you check on each xcassets the right target and unchecked the others ? – David Ansermot May 30 '16 at 18:23
  • Yes. Every single xcasset has only the correct target selected. – CFlux May 30 '16 at 18:27
  • 1
    You've nuked Derived Data and cleaned? – sschale May 30 '16 at 18:44
  • Just did that. But it didn't work anyway. AND, I deleted from my mac the image that shows in the app. I was trying to force client 2 image to load. Somehow the baseapp image loads. I don't even have it in my mac anymore. – CFlux May 30 '16 at 19:10
  • Another update: I was doing all this testing in iPhone. Then I tested it in the simulator. In the simulator it worked just fine. Now I am concerned that this could happen when I upload the app to the AppStore. – CFlux May 30 '16 at 19:26
  • I have the exact same issue. app icons work for new target but launch image refers back to original target – Kerry Davis Oct 12 '16 at 16:39
  • 10
    I had exactly the same problem, and solved it by restarting the iOS Device. It seems that iOS caches the Launch Images/Screens, and when the developer changes the Launch Screen in XCode, these changes do not always appear on the device due to this cache. Got this solution from here: http://stackoverflow.com/a/33698093/4337911 – Kii Oct 28 '16 at 07:13

2 Answers2

2

I was facing the same issue and finally solved this: (I am using Xcode 11.3 now)

  • Select your target from the project navigator and select target's "All" or "Customized" settings
  • Go to Build Settings->Asset Catalog Compiler
  • Change value for Asset Catalog Launch Image Set Name

Or

  • Select your target from the project navigator
  • Search "Launch Image" and change LaunchImage name in "Asset Catalog Compiler" section.

enter image description here

If the new launch screens do not show, try deleting your app and install it again.

Also, make sure the Launch Screen File option in your target's General Settings is blank.

Mohit Kumar
  • 2,898
  • 3
  • 21
  • 34
0

The solution of Mohit Kumar did not work for me, Maybe it is an XCode Bug (12.0.1) What worked for me was to create different LaunchScreen files for each target.

Johana Lopez 1327
  • 165
  • 1
  • 3
  • 14