Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to debug app when launch by push notification in Xcode

I am using Xcode 5. I am working with push notifications in iOS. I am getting satisfying results for background mode and foreground mode that can be debugged easily on an iOS device.

But problem is when app is in closed state and launched by push notification tap but I don't know how to debug in this situation. I know the solution for Xcode 4 but not for Xcode 5.

So is there any solution for Xcode 5 and debugging the app when launching it by push notifications? Provide steps to debug in this situation.

like image 668
dk-obl Avatar asked Jul 10 '14 08:07

dk-obl


People also ask

How do I run a debug app in Xcode?

When you run an application in Xcode, the debugger is automatically started and attached to the process of the application. Click the Run button in the top left or press Command + R. From the moment the application is up and running, we can start inspecting the process and, if necessary, debug it.


2 Answers

Edit your project scheme and set "Launch" to "Wait for *.app to be launched manually". Then Run the project or hit "cmd+R". The app will not be launched automatically, but the debugger will attach to the process as soon as the app launches. So send your test push notification, and launch the app from the push.
Here you go!

enter image description here

like image 79
arturdev Avatar answered Oct 25 '22 00:10

arturdev


it takes few seconds:

1- go to edit schema

2- select run section from left list

3- then in info tab goto part launch options

4- select option: wait for executable to be launched

5- then close the window

6- run the app : the app will build but not launched because it's waiting for you to launch the app manually

7- at this time send your notification to your device

8- tap on the notification and your app will launched and the debugger goes to breakpoints you attached in lines of code

like image 29
jamal zare Avatar answered Oct 25 '22 00:10

jamal zare