Hello,
how can I use the processor symbol HOTRESTART to prevent the loading of storyboard and XIB files?
If you have a storyboard or XIB file, and you are using hot restart, you can refer to the following code:
#if !HOTRESTART
UIStoryboard Storyboard = UIStoryboard.FromName ("LaunchScreen", null);// if you are not using hot restart, you can get the Storyboard
UIViewController vc = Storyboard.InstantiateInitialViewController () as UIViewController;//Then the logic can be processed
#endif
Your main purpose is to disable the LaunchScreen.storyboard
when you are using hot restart.
For this, you can open Info.plist with source code editor, then remove the UILaunchStoryboardName
key to test.
(Your app will not have a splash screen for now, you can add this key if you don't use hot restart)
After that, you can uninstall the app in your device, clean the bin/obj folder, and deploy/debug the app again.
For more details, you can refer to Xamarin.Forms splash screen - Xamarin | Microsoft Learn
Best Regards,
Wenyan Zhang
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentationto enable e-mail notifications if you want to receive the related email notification for this thread.