12
votes

My website crashes on Mobile Safari, but works fine on desktop.

How can I determine why it is crashing?

2

2 Answers

22
votes

What you can do when Safari quits unexpectedly showing your website:

1. Safari debug console

Use Safari's debug console. Switch on in your iPhone: Settings->Safari->Advanced->Debug console=on.

For me it says

  • 2 HTML errors on Line 6 (Viewport argument value "device-width" for key "width" not recognized and Viewport argument value "no" for key "user-scalable" not recognized.)
  • 2 HTML tips also n Line 6.

Debug console will be shown next time you check your web page using Safari.

2. Web Inspector (from iOS 6.0)

If it is getting more complicated to find out the problem in your webpage use Web Inspector to Debug Mobile Safari. It is a great tutorial for this.

Using IOS Simulator I found that for this particular website all iOS version I have, 5.0, 5.1 and also 6.1, runs the page correctly with crashing the page but on device (iOS 5.0.1) still crashes.

My device runs on iOS 5, so I cannot access Web Inspector, but it is certainly the next step for you to check your site on device and check Web Inspector on your machine.

3. Use iPhone Configuration Utility's Console

You can downlod Apple's iPhone Configuration Utility, then you can access your mobile's Console during Safari test.

Checking your site I see couple of memory warnings which eventually lead to Safari crash.

4a. Use Xcode's debug facility

Using Xcode you can also access the device's Console (Window->Organizer->Devices tab->Console).

Your case reported the following on console:

Apr 30 10:15:18 unknown kernel[0] <Debug>: launchd[2489] Builtin profile: MobileSafari (sandbox)   
Apr 30 10:15:38 unknown MobileSafari[2489] <Warning>: Received memory warning. 
Apr 30 10:15:39 unknown SpringBoard[15] <Warning>: Received memory warning. 
Apr 30 10:15:50 unknown UserEventAgent[12] <Notice>: jetsam: kernel termination snapshot being created 
Apr 30 10:15:50 unknown com.apple.launchd[1] <Notice>: (UIKitApplication:com.apple.mobilephone[0xb2a4]) Exited: Killed: 9
Apr 30 10:15:50 unknown com.apple.launchd[1] <Notice>: (UIKitApplication:com.apple.mobilesafari[0xf755]) Exited: Killed: 9
Apr 30 10:15:50 unknown SpringBoard[15] <Warning>: Application 'Phone' exited abnormally with signal 9: Killed: 9
Apr 30 10:15:50 unknown SpringBoard[15] <Warning>: Application 'Safari' exited abnormally with signal 9: Killed: 9
Apr 30 10:15:52 unknown ReportCrash[2491] <Error>: Saved crashreport to /Library/Logs/CrashReporter/LowMemory-2013-04-30-101552.plist using uid: 0 gid: 0, synthetic_euid: 0 egid: 0

4b. Use Xcode's debug facility, Instruments

Another sophisticated way to check what's happening is to use Instruments.

Checking again your site I see many-many low memory warning reported by Safari before it quits. Sadly it doesn't directy help you discovering the web site problem but maybe helps to find Safari open bug reports.

3
votes

I had success debugging a crash by doing the following:

  1. connect to the phones console using xcode
  2. find the crash in the console, in my case is looks like this:

    Sep 2 17:16:21 Edwards-iPhone ReportCrash[7093] : Saved report to /Library/Logs/CrashReporter/JetsamEvent-2015-09-02-171621.ips

  3. Then go to Diagnostics in settings (settings > privacy > diagnostics & usage data - that's on ios 8.4. It's in a different place on other versions) and find the crash file.

This removes the need to guess at which crash reports the one you experienced.