I found the reason. When the loaded home page is initialized, there is a data reading operation that is performed synchronously, which will block the UI thread and cause the UI to briefly black screen. Just change it to asynchronous.
You can print the timestamp on the didFinishLaunchingWithOptions first line of appDelegate and the timestamp of viewDidAppear on the home page to see if the difference between the two is too long. Are there any time-consuming operations on the main thread, such as reading and writing databases, loading large files, etc.
Occasional bugs are more difficult to deal with. Did the ViewController of the first interface do anything to block the main thread before ViewAppear? If not, you can first try assigning LaunchScreen to a StoryBoard file and then fill the LaunchScreen with pictures.
The black screen means that your rootVC interface is not displayed, or it is black or empty. It is recommended to set the view of rootVC to an eye-catching color, such as red, and check the situation
I found the reason. When the loaded home page is initialized, there is a data reading operation that is performed synchronously, which will block the UI thread and cause the UI to briefly black screen. Just change it to asynchronous.
I suspect it took too long.
You can print the timestamp on the
didFinishLaunchingWithOptions
first line of appDelegate and the timestamp of viewDidAppear on the home page to see if the difference between the two is too long. Are there any time-consuming operations on the main thread, such as reading and writing databases, loading large files, etc.Occasional bugs are more difficult to deal with. Did the ViewController of the first interface do anything to block the main thread before ViewAppear?
If not, you can first try assigning LaunchScreen to a StoryBoard file and then fill the LaunchScreen with pictures.
Is the rootViewController of your window set?
The black screen means that your rootVC interface is not displayed, or it is black or empty. It is recommended to set the view of rootVC to an eye-catching color, such as red, and check the situation
self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
self.window.backgroundColor = [UIColor whiteColor];
self.window.rootViewController = XXX;
[self.window makeKeyAndVisible];
Is it that the startup page corresponding to the device screen size has not been added
The startup page is not loaded, don’t use lanuchimage, create a StoryBoard and spread the pictures on it, it will be ok
I also have the same problem. The LaunchImage shows that when the program is re-awakened, the page comes out and the screen flashes black.