1

I'm currently building an app with Cordova, and it appears that on the last alpha version, the app only works in the iOS Simulator. When ran on an iPhone X, the app is crashes immediately.

I'm not familiar at all with software development for Apple platform, so I was wondering:

  • What are my options to understand what is wrong?

  • Is there some kind of things that I should be aware of to avoid silent crash?

I know we can link an iPhone with the Safari debugger, but I assume this will only work for browser inspection, not app debugging.

  • This seems a bit out of scope here. Was this asked on SO or any objections to migrating it there? See help center and hit us up on Ask Different Chat or Ask Different Meta if needed. – bmike Aug 30 '18 at 13:08
  • I started to do it, but I think it's also out of scope for SO, as it's not really code-related (well, my issue is, but I'm only asking for software support). – zessx Aug 30 '18 at 13:11
2

You can debug the app by running it on device via Xcode.

First lets get the pre-requisites right. You'll need access to a Mac with recent version of macOS and Xcode installed (preferably latest for each, macOS High Sierra 10.13.6 and Xcode 9.4.1).

After you have your Mac ready, get access to the source code for the app. Open the xcodepoject file for the project file with Xcode. The project file for a project named Sample looks like this in Finder:

enter image description here

Once you have the project open with Xcode, your next step will be to successfully build it. Do it by pressing Shift + Command + r or selecting Product → Build For → Running from the Xcode Menu bar. A successful build (no compilation errors) is indicated by this HUD shown on the desktop:

enter image description here

Next step would be to run on device. Connect your iPhone X to your Mac using the lightning cable. Verify that the device is connected and is recognized by Xcode as will be shown in the run destination selection dropdown in the Xcode toolbar:

enter image description here

Once the device and the app name is selected in the dropdown as shown above, to run the app, click on the play button in the toolbar, or select Product → Run from the Menu bar or use the keyboard shortcut Command + r.

Now the app should launch on your iPhone. Make sure your iPhone is unlocked and both the Mac and iPhone have trusted each other. You will need to add your registered Apple developer ID into Xcode to be able to debug app on device (if not done so already).

enter image description here

Assuming that everything mentioned above is setup correctly, you should be able to launch the app on your iPhone via Xcode and debug it.

Detecting Crash:

As you mentioned that your app is crashing on launch, I am assuming you are getting the build onto device and experiencing it. To pin-point the reason for crash in your apps code, you can take the following steps:

  1. Navigate to the Breakpoint Navigator in Xcode by pressing Command + 8 or selecting View → Navigators → Show Breakpoint Navigator in the Menu bar.

  2. Click on the Create a breakpoint button indicated by + shown in the bottom toolbar area.

enter image description here

  1. Select Exception Breakpoint...

enter image description here

  1. Click outside the popup to dismiss. Make sure that the breakpoint is enabled to be able to catch the reason for crash.

Good luck!

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .