Forum Xamarin Xamarin.Forms

iPhone version of Xamarin Forms app launches to blank screen and immediately goes to the background

I've been testing and running my Xamarin forms app on an iPhone 5s, being the minimum version of the iPhone I want the app to run on. It works fine on the iPhone 5s, but not on an 8s or X. It compiles and launches without errors, but simply show's a blank launch screen for about a second or two and then goes to the background. It doesn't crash, it simply sits in the background with the blank screen. I can't run this app on a simulator since it uses bluetooth. I'm completely up to date with Visual Studio for mac 2019, Xamarin forms and all of the nuget packages that I'm using. To make things worse, it won't stop at any breakpoints when running in debug, which appears to be a seperate issue since this is also an issue with a simple test master/detail app. The simple master/detail app however runs fine. Any helps or ideas on what might be going to on is greatly appreciated.

Best Answer

  • DouglasMarshDouglasMarsh USMember ✭✭
    Accepted Answer

    I found the problem. I had to enable Background modes in info.plist. This exposed the option for communication with Bluetooth LE. Once that was done the app no longer stays in the background and launches normally. I didn't suspect this since everything operated normally with iOS 10.x In looking around at settings, "Background Mode" didn't register that it had anything to do with Bluetooth. Now it seems obvious. I also wouldn't have thought that the symptoms would be what they were, with the app not fully launching to the foreground. Thanks for your help.

Answers

  • LandLuLandLu Member, Xamarin Team Xamurai

    I guess your iPhone 5s uses the different iOS version comparing to the iPhone X. Maybe, some specific code is not compatible with the latest iOS version. What do you mean " it simply sits in the background with the blank screen."? Did it persist displaying a blank page if you force click the icon to open your application?
    It seems something blocks the process so that the content could not be displayed. You've mentioned bluetooth is consumed in your application the issue could be caused by this part as a simple master detail app runs fine.
    If you can't reproduce it on a sample I suggest raising a support ticket here: https://support.microsoft.com/en-us/supportforbusiness/productselection?sapId=211dd84f-3474-c3c5-79bf-66db630c92a6. Upload your project there to help us take some analysis.

  • DouglasMarshDouglasMarsh USMember ✭✭

    Yes, the iPhone 5s is running 10.3 while the 6s, 8 and X are running 13.x When I run the app is displays the blue screen (blank) for a couple of seconds before going to the background. If I force click app in the background it does the same things. Jumps to the foreground for a couple of seconds and then goes back to the background. I'm working on creating the simplest app that will give the same results. I am using Syncfusion controls and Prism. This is a pretty sophisticated app, so trying to break it down is turning out to be a challenge. I'd been doing all of the testing on the android and then occasionally testing on the iPhone5 thinking that the new iphones/ios versions would be fine. This caught me off guard. Stripping it back is turning out to be challenge.

  • LandLuLandLu Member, Xamarin Team Xamurai

    I know it's a little complicated. Maybe you placed too much task in the launched event of AppDelegate. However, we can't find out the root cause without your code.
    If you do feel difficult to reproduce a sample you could try to open a support ticket using the link I posted above. Microsft promises to protect your personal data if you upload the projects there.

  • DouglasMarshDouglasMarsh USMember ✭✭
    Accepted Answer

    I found the problem. I had to enable Background modes in info.plist. This exposed the option for communication with Bluetooth LE. Once that was done the app no longer stays in the background and launches normally. I didn't suspect this since everything operated normally with iOS 10.x In looking around at settings, "Background Mode" didn't register that it had anything to do with Bluetooth. Now it seems obvious. I also wouldn't have thought that the symptoms would be what they were, with the app not fully launching to the foreground. Thanks for your help.

Sign In or Register to comment.