Debugging allows you to go through each line of code, evaluating your app's variables, methods and how well your code is working. It's easier to find small mistake in large pieces of code. In this article we will go through basic tips and tricks on debugging an Android app.
The History of Push Notifications Push notifications were originally introduced for Android and iOS devices in 2009, and have rapidly grown in popularity.
A push notification is a message that pops up on a mobile device, such as a sports score, an invitation to a flash sale or a coupon for downloading. App publishers can send them at any time, since users don't have to be in the app or using their devices to receive them.
In Xcode < 4.0 (for Xcode >= 4, see answer by delirus below), you can now configure Xcode to attach the debugger to the app after you launch it, instead of launching the app through the debugger. This lets you debug things that vary based on the launch state of your application, such as URL schemes, pasteboards, and push notifications.
Now when you click debug from Xcode instead of launching the app a window will display telling it is waiting for the app to launch. You then launch the app normally on the phone and Xcode attaches to it
For Xcode 4 you have to:
More here in "Customize Executables in the Scheme Editor" section.
EDIT:
In case you miss logs in GDB, see Louis Gerbarg's comment to his answer.
For Xcode 10, 9, 8, 7 & 6:
Now you can debug when launching from a notification, custom url or by touching the app icon.
I'm not working with push notifications, so I don't know the exact working of push notifications. However, I'd try mimicking the receipt of a push notification by letting the main method of your program pretend a notification was posted if possible, or calling the application:didFinishLaunchingWithOptions: UIApplicationDelegate method from within the applicationDidFinishLaunching: method.
HTH - Cheers, Daan
In Xcode 6:
Debug
> Attach to Process
> Pick your AppFor Xcode 11 and 10, you can do the following:
Select Scheme option.
Choose Edit Scheme.
Select Run option from the left panel
In the launch part, select wait for executable to be launched, then close the dialog.
Build and run the project. You can now launch the app either by tapping the app icon, or by tapping on the notification message.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With