在iO10以前的版本越獄機器可以用socat方便的打印出NSLog信息,但在iOS10下由于日志系統(tǒng)發(fā)生了改變闻妓,以前一些打印方法失效耍休。
The logging system has changed in iOS 10. Apple now uses what it calls "Unified Logging". Below are links to a brief overview, as well as a WWDC session covering the topic:
https://developer.apple.com/reference/os/logging
https://developer.apple.com/videos/play/wwdc2016/721/
Note that Apple claims that it is much more efficient (as it does not write to disk), and so it appears that there is no need to ever turn it off.
iOS10下可用deviceconsole這個工具打印系統(tǒng)日志耐薯,安裝方法從git上下載源碼https://github.com/MegaCookie/deviceconsole并編譯,將編譯好的二進制文件觅彰,放到/usr/local/bin下并保證執(zhí)行權(quán)限。
deviceconsole是需要通過usb來連接手機钮热,在終端中運行deviceconsole填抬,并連上手機,操作說明如下:
Usage: deviceconsole [options]
Options:
-i | --case-insensitiveMake filters case-insensitive
-f | --filter Filter include by single word occurrences (case-sensitive)
-x | --exclude Filter exclude by single word occurrences (case-sensitive)
-p | --process Filter by process name (case-sensitive)
-u | --udid Show only logs from a specific device
-s | --simulator Show logs from iOS Simulator
--debugInclude connect/disconnect messages in standard out
--use-separatorsSkip a line between each line
--force-colorForce colored text
Control-C to disconnect
比如打印iOSRETargetApp這個app的信息隧期,可用deviceconsole -i -f iOSRETargetApp命令飒责,打印結(jié)果如下:
tdxs-Mac-mini:bin tdx$ deviceconsole -i -f iOSRETargetApp
Mar3 10:14:22 sjjvenumediaserverd(AudioToolbox)[269]:1067: pid 1103(iOSRETargetApp)
Mar3 10:14:25 sjjvenuiOSRETargetApp[1103]:addButtonTapped
Mar3 10:14:27 sjjvenuiOSRETargetApp[1103]:addButtonTapped
Mar3 10:14:27 sjjvenuiOSRETargetApp[1103]:addButtonTapped
Mar3 10:14:28 sjjvenuiOSRETargetApp[1103]:addButtonTapped
Mar3 10:14:55 sjjvenuiOSRETargetApp[1103]:addButtonTapped
Mar3 10:14:56 sjjvenuiOSRETargetApp[1103]:addButtonTapped
Mar3 10:15:37 sjjvenumediaserverd(AudioToolbox)[269]:1067: pid 1103(iOSRETargetApp)
Mar3 10:15:38 sjjvenumediaserverd(AudioToolbox)[269]:1067: pid 1103(iOSRETargetApp)
Mar3 10:17:00 sjjvenuSpringBoard[317]:Process exited: ->
Mar3 10:17:10 sjjvenuiOSRETargetApp(Flex.dylib)[1244]:FLXX: Loaded patches from: /var/mobile/Library/Application Support/Flex3/patches.plist
Mar3 10:17:10 sjjvenuiOSRETargetApp(libsystem_trace.dylib)[1244]:subsystem: com.apple.siri, category: Intents, enable_level: 1, persist_level: 1, default_ttl: 0, info_ttl: 0, debug_ttl: 0, generate_symptoms: 0, enable_oversize: 0, privacy_setting: 0, enable_private_data: 0
Mar3 10:17:10 sjjvenuiOSRETargetApp(iOSREHookerTweak.dylib)[1244]:====== Find Short C Function!
Mar3 10:17:10 sjjvenuiOSRETargetApp(iOSREHookerTweak.dylib)[1244]:[iOSREHookerTweak] Tweak.xm:51DEBUG:Hello Test HBLogDebug