简体   繁体   中英

How can I debug an iOS app executed in mobile not launched by Xcode?

I am developing an application for iOS in Objective C with Xcode. This application schedules local push notifications every 6 hours and it is crashing when I open the push notifications.

I need to debug the error to solve it. I can have the mobile connected to Xcode, but as the app is executed from local push notification I can't see the error messages on my Xcode debug console, as I haven't launched my app from Xcode.

Is there a way to have the iOS device connected to my Mac and see what error is happening?

I know that I can go to the mobile settings to view logs, but these logs are too ambigous for me aren't giving any error.

In addition to opening the console log as described by @saurabhgoyal you can tell Xcode to wait for your app to launch and then attach the debugger to it when it does.

Select the scheme you're using to build your app, select edit scheme, and click on the run icon. Then Look for a pair of radio buttons titled "Launch" and select the one with the name "Wait for executable to be launched."

Then when you run your app in Xcode it builds it and installs it on the device but does not launch it.

When your notification fires and the app launches the debugger attaches to your app and you can debug as normal (except that NSLog statements don't print to the debug console any more - an annoyance.)

Yes there is a way to see device logs on Mac.

Connect your iOS device to the Mac system using USB

Launch Xcode–>Window–>Devices

Select your device from the left panel

Now you can see the logs on the screen including the background activities.

In order to save the running logs.

Reproduce the issue or start working on your device on a the app you wanted to capture the logs. After the issue is reproduced click on the Save Console icon bottom right corner Xcode screen

For more details please visit this link

Hope this Helps!

Check your crash log

1.Launch Xcode on your desktop machine.

2.Open the Xcode Devices window. (Window menu -> Devices and Simulators, or Cmd-Shift-2.)

3.Find your device in the left sidebar, then select “device logs”.

Choose a Chrome crash (or multiple crashes) and select “Export” at the bottom of the Organizer window.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM