Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 662
user3427013 Avatar asked Mar 27 '18 10:03

user3427013


1 Answers

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.

like image 134
mfaani Avatar answered Sep 29 '22 13:09

mfaani