This is taking far longer than it should. For days now I’m struggling to debug a Safari App extension. Long story short, Messages are only sent with random levels of success from the extension to the host app. I would absolutely love to add some log messages into my SafariWebExtensionHandler
. Only I cannot for the life of me find them. I know everyone will say
Console.app
Trust me I have looked.
Where are these illusive log messages and why are they so hidden??
import SafariServices
import os.log
class SafariWebExtensionHandler: NSObject, NSExtensionRequestHandling {
func beginRequest(with context: NSExtensionContext) {
os_log(.default,"Just to see something from here would be a start");
.... other logic
}
}
In Console.app I have both Include Info & Debug Messages
checked in the Action
Menu.
Selected my iPhone on the left.
Selected start streaming.
Launched the App from Xcode.
Launched Safari and interacted my a website. The extension is working cos the functionality my extension provides is evident.
I run some action that triggers a browser.runtime.sendMessage
. The message is sent as the ‘SafariWebExtensionHandler’ sets a value to UserDefaults(suiteName: "group.app.myApp")
.
But I need to find this os_log
.
Return to Console.app
. Try to filter for the phrase in the message
“Just to see something from here would be a start”
Not there.
Try to filter via extension name. Not there. The Host App. Also not there,.
Help me please.