I’m developing WidgetKit extension on iOS 14,
however, the extension doesn’t always connect to Xcode debugger after build and run, causing I can’t see logs, as this image shows: (But sometimes it’ll automatically attach, I don’t know why)
If the extension is attached to debugger, it should look like this, and print logs:
Manually attach process to debugger doesn’t works, it should be attached at first launch to see logs.
Does anyone know how to properly debug iOS 14 widget?
4
Answers
You can log your useful information in local file, just like this:
Try plugging in your physical device and running it on that instead of a simulator. That fixed the logging issue for me.
To debug, or see print info: (This works for me)
On the top left of Xcode->
Click project name, you can see a list, select widget name, run it
Click widget name, you can see a list, select project name, run it
Xcode: Version 12.3, iPad: iPadOS 14.3
Xcode 14.1 known issue:
Xcode 14.1 release notes seems to mention a known issue
Approach (works on simulator and device)
Steps
Debug
>Attach to Process
> Select your widget target nameIn case above doesn’t work:
DerivedData
folderNote:
Now your breakpoints should work as expected and you can debug
Log messages
Use
Logger
to log messages, open the console (Mac app) and view the log messages there. That way you can debug even when you are not running the app / widget