On iOS when I run my Autofill extension target from Xcode and attach to Safari, Swift print() statements appear in the Xcode console log. If I run the same extension on MacOS Sequoia, no log messages appear. The header strip in the debugger area remains blank. Anyone know how to see these log messages?
In both cases, the scheme is set to Debug build, and "Debug Executable" is not selected. In fact, for iOS the "Debug Executable" is grayed out. When I set Debug Executable on the MacOS run, I get failure to attach with a warning about permission to debug Safari.
The more obscure your app or system extension, the more important it is to lean into the system log. Logging to stdout
is fine for simple things, but once you start building a complex product you usually run into some case where you can’t see such output. Moreover, you can never see such output once you ship your product, which makes it much harder to debug problems that only show up in the field.
So, my advice here is that you use this as an opportunity to switch over to the system log. It’s easy to use, has many great features, and your log entries will be visible regardless of the context.
See Your Friend the System Log for lots of hints and tips on this front.
Share and Enjoy
—
Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"