Black launch screen after a few launches, first launch fine

Hi,


I've tried to add a launch screen to my app but can't get it to work consistently:


- On simulators, it works all the time (all iPhones and iPads including iPad Pro)

- On my iPad Air, it works the first time I install the app after a fresh restart. Then, when I run it a second time, I get a black launch screen before the main interface appears. Remove app, run again (reinstall), black launch screen. Restart iPad, run app, black launch screen. Remove app AND restart iPad, run again: correct launch screen. Run it again, black screen.


In the system logs, I find multiple entries like:


Dec 2 23:19:50 iPad-van-Marina-van-Vugt splashboardd[191] <Error>: ImageIO: CGImageReadCreateDataWithMappedFile 'open' failed '/var/mobile/Containers/Bundle/Application/1B97BA77-69A0-4B78-920C-DF8560F779C4/Kaodoku.app/Splash@2x.png'

error = 2 (No such file or directory)


However, the same image is used within the app where it is loaded just fine, so it's definitely there. With the correct capitalisation and everything.


I just tried another experiment: Remove app, restart iPad, run app, kill app using device (2 x home button, swipe up, then "Step over" in Xcode to finish it), tap on app icon. Works OK. Killed and restarted app several times, still OK. Run again from Xcode: black launch screen. Every next attempt at launching with any method yields yet another black screen.


On my iPhone 5, the launch screen seemed to work fine with multiple runs ("Run" from Xcode), until I tried "Run" while holding the device upside down. Now I got a black launch, and every subsequent launch in normal orientation is black as well. Only way to get a correct launch screen again is delete app and restart device.


I've already read a few threads on this forum and other developer forums and tried to follow the suggestions. I had first tried a storyboard, but then followed a suggestion on these forums and used a xib instead (deleting the storyboard). So now I have "LaunchScreen.xib" (which becomes a nib in the compiled app) and a plist entry "LaunchScreen". I've selected "Use as launch screen". I've tried entering it as "Main Interface" but removed it again since that didn't help. I've changed the launch image set (for older iOS versions) to only include iOS 6.0 and prior (since a post on some other developer forum suggested that). Nothing changes anything.


Thanks for any help,


Michel Colman

OK, it gets weirder. The startup screen I'm using has two UIImageViews, a wood background (which is also used in the game) and a text on top. This morning, when I tried the exact same experiment as yesterday (wipe app, restart iPad, run app from XCode, run again), I no longer get a black screen but a screen with the wood background but without the text! So on the first launch both images loaded, but on the second launch only one did and the other did not. When I look in the console, though, I get two error messages for the text image (which is not displayed) and four messages for the wood background (which is displayed).


I'm also confused about the file path in the error messages: it doesn't match the application directory from the first run nor from the second run. I was thinking it might have cached the application directory and therefore couldn't find the pics there since that directory changes on each install, but no, it matches neither the old one nor the new one. But apparently it DOES find the wood background in that nonexistent directory!


Did the experiment again just now:

- Wipe app from device

- Restart device

- Run app from Xcode. App directory /var/mobile/Containers/Data/Application/E79D591B-7187-4588-B676-10C7CED1ABE2/

- Launch screen displayed correctly, no errors in console

- Run app from Xcode again. App directory /var/mobile/Containers/Data/Application/856E245B-565D-4CF4-B384-9B440AFCBF28/

- Launch screen only shows wood background (Hout@2x.jpg) but not text (Splash@2x.png)

- Console has errors:


Two times this message:

Dec 3 11:22:44 iPad-van-Marina-van-Vugt splashboardd[195] <Error>: ImageIO: CGImageReadCreateDataWithMappedFile 'open' failed '/var/mobile/Containers/Bundle/Application/7F09DC96-0468-4939-867D-0CE6D85B2B06/Kaodoku.app/Splash@2x.png'

error = 2 (No such file or directory)

And four times this message:

Dec 3 11:22:44 iPad-van-Marina-van-Vugt splashboardd[195] <Error>: ImageIO: CGImageReadCreateDataWithMappedFile 'open' failed '/var/mobile/Containers/Bundle/Application/7F09DC96-0468-4939-867D-0CE6D85B2B06/Kaodoku.app/Hout@2x.jpg'

error = 2 (No such file or directory)


Note that the directory does not match any of the previous ones. But Hout@2x is loaded anyway. (Which yesterday was not the case, even though I have not changed anything whatsoever)


Any ideas, anyone? Should I even worry about this? I've noticed that lots of other apps are launching to a black screen as well, so this has to be some sort of bug in iOS 9.


Thanks,


Michel

> I've noticed that lots of other apps are launching to a black screen as well, so this has to be some sort of bug in iOS 9.


Are you running some beta version of iOS? I never see this on the release version of 9.1. Maybe your device needs a restore.

iOS 9.1 (13B143), regular update, no beta.


And I'm not the only one having this kind of trouble:

https://forums.developer.apple.com/thread/17817


In the first post in that thread, someone writes they saw several other apps do it.


I did apply the "correct answer" but it just works for the first launch, not subsequent launches from Xcode.

(2 x home button, swipe up, then "Step over" in Xcode to finish it)

Why do you have to "Step over" in Xcode?

When I kill my app this way, the code simply runs as expected with no interaction required.

For some reason it always breaks on the last line of main (the one with "return UIApplicationMain") with a pink message "Thread 1: signal SIGKILL" on the right of that line. I thought that was normal?


It looks like it only does that if I first press the home button to go to the home screen and then kill it with double home button + swipe. If I just do the double home + swipe while the app is still active, Xcode just says "Finished running".


Anyway, I don't think that has anything to do with the problem.

-(void)applicationWillTerminate:(UIApplication *)application


What are you doing when this message is received?

In ApplicationWillTerminate, I just save the game state (NSUserDefaults standardUserDefaults).


But anyway, if I just "Run" from Xcode, the app is terminated immediately so I don't think that can have anything to do with it.

"For some reason it always breaks on the last line of main (the one with "return UIApplicationMain") with a pink message "Thread 1: signal SIGKILL" on the right of that line. I thought that was normal?"

Nope.

That's a crash.

You'll need to provide the symbolicated crash log to determine the line number that is causing the crash.

Do not post the binary images at the end of the crash log.

Sorry I didn't reply sooner, but I just tried the following:

- New project, iOS App

- Run

- Home button

- Double home button, swipe up

The debugger shows a red breakpoint with "Thread 1: signal SIGKILL".

So it seems to be normal behavior, not a bug in my app.

But anyway, once again, this has nothing to do with my original problem.

Black launch screen after a few launches, first launch fine
 
 
Q