Debugging App When Launched by Push Notification

How to debug app when launch by push notification in Xcode

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!

iOS Sample Image 40

How to debug remote push notification when app is not running and tap push notification?

I have solved it by implementing sceneDelegate willConnectTo method. There is no need to handle it in didFinishLaunchingWithOptions

func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) {
//Remote notification response
if let response = connectionOptions.notificationResponse{
print(response.notification.request.content.userInfo)
}

....
}

This is enough

Debugging App When Launched by Push Notification

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.

  1. In Xcode look in the Source bar, and below Targets there will be Executables.
  2. Bring up the inspector for your app in executables.
  3. Click on the Debugging tab tab in the inspector.
  4. Uncheck "Start executable after starting debugger"
  5. Check the "Wait for next launch/push notification"

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

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

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.)

Attach debugger to an app cold-launching from a push notification

If you edit your build scheme and open the run options there are a pair of radio buttons called something like "Launch automatically" or "Wait for launch". You want the "wait for launch" option.

(I'm not at my Mac so I don't have the exact titles of the buttons. Sorry.)

Then when you run your app from the debugger it installs it and then Xcode sits and waits for an external event to launch the app. This facility is built for exactly what you're trying to do.

Debugging app launched by push notification in Xamarin Studio

No, this is currently not possible in Xamarin Studio.

If you file an enhancement request at http://bugzilla.xamarin.com you'll be notified if/when it's implemented.

Why don't I receive iOS Push Notifications with a debug build connected to Xcode debugger?

The solution ended up being that our server with the Houston gem needed to configure its APNS support to be in development mode, and not in production mode. /p>


Related Topics



Leave a reply



Submit