Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
336 views
in Technique[技术] by (71.8m points)

ios - How can I retrieve messages logged with os_log from iPad/iPhone?

I am using the new Unified Logging API in Swift.

So I create a logger and use it as below:

let testLogger = OSLog(subsystem: "my.subsystem", category: "test")
os_log("just a test: %@", log: testLogger, type: .error, "error")

How can I retrieve the logged message if the iOS device is disconnected from the Mac?

I know that the new Console application shows messages logged when the device is connected to the Mac. However, I want to retrieve a message that was logged when the device was disconnected from the computer. How can I achieve that?

Thank you.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

On iOS 11, you can now capture a sysdiagnose and get access to the sysdiagnose for emailing (don't email this, it's huge), or exporting to dropbox/airdrop to your Mac. Instructions.

The gist of it is :

  • hold down volume up and volumn down and power button for 1.5 seconds until the screen vibrates.
  • then wait for upto 10 minutes and on your iOS 11 device go to:

Settings > Privacy > Analytics > Analytics Data > sysdiagnose_[xxx] > tap share icon in the nav bar. For me it took less than a minute.

You would need to scroll down to the data starts with s and then it will be something like sysdiagnose_2018.12.13_14-16-19-0500_iPhone_OS_iPhone_15G77

Then share it through AirDrop. You don't need a cable and iTunes anymore.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...