is NSLog() stored on the device (iPhone etc)? If so, where?

前端 未结 6 764
旧时难觅i
旧时难觅i 2020-12-16 20:18

Should all NSLog() calls be deleted in the final app for iTunes?

In my iOS app, I\'ve got lots of NSLog() for debug. Should I conditionally code them out before uplo

6条回答
  •  悲哀的现实
    2020-12-16 21:08

    I'll answer the OP's question in the title about where the logs are stored on the device. NSLog() uses the ASL (Apple System Logger). Programmatically, you can only read the last 256 entries (which is what Xcode shows in the Organizer, for example).

    However, if you want to access the full files, they are stored in:

    /private/var/log/DiagnosticMessages
    

    When you look into that directory (note: device must be Jailbroken), you'll find a long list of *.asl files.

    I found a tool to parse those files, but I haven't tried it yet, so YMMV:

    Parsing Apple System Log (ASL) files on iOS and OSX for Fun and Evidence (and a Python script to do it for you)

提交回复
热议问题