Image does not update when changed if that image i

2019-05-11 16:13发布

问题:

First of all this question has nothing to do with other similar questions on SO because this problem involves using LaunchScreen.storyboard and the solutions presented on SO don't solve this problem.

I am using an image inside LaunchScreen.storyboard. I change that image and every time the app starts it shows the old image. Things I have tried:

  1. Name the image differently every time
  2. Delete de DerivedData contents
  3. Move the image from the Assets file to the outside
  4. Product > Clean
  5. Delete the app from the device.
  6. Do all 1-4 plus quit and restart Xcode.

It is amazing but nothing works. I have tried everything except voodoo.

The techniques above seem to work for images used elsewhere but not for images used by LaunchScreen.storyboard.

I am running it on the device.

Any ideas?

回答1:

The likely problem is that Springboard caches the launch image by bundle ID. To force a rebuild, the necessary steps are

  1. Delete app from device.
  2. Restart device.
  3. Install and run app.

However, there does appear to be a so far undefined complete failure case. If the above brute force method fails to work, take a look at this Radar filing: UIImageView missing images in Launch Screen on device which appears to describe a permanent caching failure. In that case, changing your bundle ID and seeing if the expected image shows up is about all you've got left.