user3427013
user3427013

Reputation: 1099

Can't attach debugger to UNNotificationServiceExtension

I'm not being able to use the debugger in a UNNotificationServiceExtension.

Here's what I do when attempting to attach the debugger to the UNNotificationServiceExtension:

  1. Run app
  2. Set the breakpoint in the "Testing" UNNotificationServiceExtension
  3. Select Debug > Attach to Process by PID or Name > Select the "Testing" UNNotificationServiceExtension
  4. XCode indicates that the "Testing is waiting to attach"

"Testing" extension waiting to attach

  1. I then send a push notification and my iPhone displays the notification, but the debugger doesn't hit the breakpoint. Instead, XCode shows a "Thread1: signal SIGKILL".

Thread1: signal SIGKILL

Does anyone know how to get the debugger to work in a UNNotificationServiceExtension?

Upvotes: 16

Views: 3137

Answers (2)

childrenOurFuture
childrenOurFuture

Reputation: 1987

2 years ago, I used questioner's way to debug, it works. but recently it doesn't work. and I find another way.

  1. connect the device
  2. select the xxxNotificationService scheme and run.
  3. Xcode will pop up a menu to choose an app to run, select your app.

then, debugger works.

Upvotes: 0

mfaani
mfaani

Reputation: 36427

Don't hit run on Xcode when the debugger is attached to the service extension.

Connect the debugger to the Containing app and run the app. Then attach the debugger to the service extension.

I don't know why you can't run it when the debugger is connected to the service extension. I'm guessing it has something to do with NSExtensionPointIdentifier set to com.apple.usernotifications.service and once the OS sees that things go to hell because only the OS should launch the service extension.

Upvotes: 2

Related Questions