Debug Notification Extensions

前端 未结 9 853
感动是毒
感动是毒 2020-12-08 19:10

I\'m building a set of Notification Extensions (Service/Content). I\'m unable to connect to Xcode debugger or even log out to the device log or console.

Is there any

相关标签:
9条回答
  • 2020-12-08 19:36

    If you have tried all the above solutions and still scratching your head and wondering why break point point is not being called. Then try checking the deployment target of your extension it should be less or equal to your device OS.

    For me, the deployment target was higher than the device OS.

    0 讨论(0)
  • 2020-12-08 19:37

    In my case (Xcode 11.1) debug starts after this steps:

    1. run notification extension target with main app
    2. switch app to background
    3. lock the phone !
    4. send push to device
    0 讨论(0)
  • 2020-12-08 19:39

    Not sure if this will be helpful, but we have multiple builds of the same app (alpha, beta, etc). Kept getting a "don't have permissions to attach" error when trying to debug. Opening up the processes list, I noticed that there were 2 processes named notification-extension so xcode must have been defaulting to the one of the other build. By manually selecting the right one, or deleting the other builds from my phone things started working again.

    0 讨论(0)
  • 2020-12-08 19:43

    Change the target to run the extension

    then select run and choose your app from the 'Choose an app to run:' window.

    0 讨论(0)
  • 2020-12-08 19:46

    This worked for me to stop at breakpoints in the extension and see the extension log:

    1. Choose the notification extension scheme, not the main app scheme
    2. Run the app and select the main app from the list Choose an app to run
    3. Stop the app in Xcode and terminate it manually on the device; not terminating it manually results in Message from debugger: Terminated due to signal 9 after step 6. [Update: Terminating the app manually on the device doesn't seem to be necessary, try either way if it doesn't work.]
    4. Select Menu Debug > Attach to Process by PID or Name
    5. Enter the correct extension name, not the main app name
    6. Send the push notification
    0 讨论(0)
  • 2020-12-08 19:50

    I have tried as per brendan's Answer but is not working for me at all!

    I am getting below error in console

    Program ended with exit code: 0
    

    Then after searching on google i have checked this answer. however this also not worked for me for while!

    Then i have tried same steps again as given in answer, After stopping my current running app. then follow same steps.For clarity i am writing this steps as below:

    After running the app that contains the extension,

    1) Set your breakpoint in the extension
    2) Select Debug / Attach to Process by PID or name
    3) Enter the name of the extension target
    4) Trigger the push notification
    

    Before step 2 make sure to stop your current running app.

    0 讨论(0)
提交回复
热议问题