Exporting logs with OSLogStore after app was killed

Hi, I'm currently working on exporting logs from a user's phone. Let's say I want to include an option in the settings that allows the user to retrieve all logs recorded via Logger.

I've found that it's possible to use OSLogStore to get logs recorded via Logger. It has initializer with the scope of the current process identifier OSLogStore(scope: .currentProcessIdentifier). This method works fine until the app is killed or crashes. How can I retrieve the persistent logs in a manner similar to the log collect command? We need to access logs from when the app was killed or crashed, and we don't have direct access to the user's phone.

Post not yet marked as solved Up vote post of fineas Down vote post of fineas
809 views

Replies

How can I retrieve the persistent logs in a manner similar to the log collect command?

You can’t do this programmatically. I call this out in Your Friend the System Log.

we don't have direct access to the user's phone.

One option is to ask the user to trigger a sysdiagnose log and then send you that.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"