- Home /
Unity iPhone app crashes on startup on iPhone3G but works fine on iPhone3GS, iPhone4 and iPad
I have a Unity iPhone game that crashes only on iPhone3G. I have an empty initial scene. Normally that scene would load my main menu scene but I've disabled loading of the main menu scene but the app still crashes on iPhone3G with just my blank scene being loaded. My OpenGLES is set to 1.1 and I've played around with different player settings with no luck. Has anyone run into this problem?
You need to investigate stack traces of the crash to get some clues why this happens. How to obtain and analyse stack traces you can find in Unity $$anonymous$$anual Troubleshooting page: http://unity3d.com/support/documentation/$$anonymous$$anual/TroubleShooting.html#iPhoneTroubleShooting
Answer by CapnCromulent · Mar 04, 2011 at 08:43 AM
I had a similar problem where running on a 3G would sometimes take longer than 20 seconds to load, and then get automatically killed by the OS. You can verify this by examining the crash logs on the device through the Xcode organizer for a block like:
Application Specific Information: <YOUR APP> failed to launch in time
Elapsed total CPU time (seconds): 17.960 (user 11.640, system 6.320), 89% CPU Elapsed application CPU time (seconds): 13.040, 64% CPU
This would only happen on some 3G devices that were used heavily by real users; I never saw it on my test phone. Asking the user to reboot the phone would usually resolve it.
Sadly, I have no idea how to fix this without a reboot, as I was loading a near-empty bootstrap level like you are.
Answer by BigToe · Feb 09, 2011 at 05:56 AM
I'm having this problem too. My app was working fine on iPod Touch 1st Gen 3gs and 4g, so I thought I would be OK. My app just went live on the app store, and I am in for a slew of unhappy 3G users. If you figure it out, let us know.
Answer by tonycoculuzzi · Jun 14, 2011 at 02:07 PM
I would assume that loading an almost-empty scene with a second splashscreen or loading notification icon at first would solve this issue. Have the larger scene load in the background while this is happening and voila. I have yet to test this, but I'm working on it today. I'll post an update when I'm done. :)
What I did was create an empty scene with a "Loading" graphic in the bottom corner. After that scene was loaded, I called the main scene with LoadLevel(). This greatly improved load times, more than I thought it would, but it didn't help at all on the iPod. Unfortunately, I don't have Unity Pro, or Unity iOS Pro so I couldn't load the main scene asynchronously (LoadLevelAsync()), but I think that would solve the issue of load times for slower devices.
Basically, what I'm suggesting is that if you have Unity iOS Pro, load an almost-empty "Loading" scene that loads the main scene in the background with LoadLevelAsync(), then destroy the "Loading" scene after the main scene is loaded. Loading it asynchronously will stop the game from locking up, and while the load time may increase a little due to the background loading, the application won't crash because of it.