How to see NSLog() from console app when using instruments

后端 未结 4 1086
遇见更好的自我
遇见更好的自我 2020-12-30 19:36

I\'m using instruments for allocations, but want to see my NSLog messages. In another post they mentioned to look inside /Applications/Utilities/Console for the messages.

相关标签:
4条回答
  • 2020-12-30 20:06

    If you want to use the Console Application, the Xcode log can be found under the FILES section in the Log List (If not visible:Menu -> View -> Show Log List). Look for

    ~/Library/Logs/iOS Simulator/6.1/system.log
    

    This is actually just a reference to the file system. So you could to a

    tail -f ~/Library/Logs/iOS Simulator/6.1/system.log
    

    in the Terminal as well.

    Update:

    Another option in some newer versions of Xcode can be found in the Xcode 'Debug' menu. Look for the entry 'Open System Log...'.

    0 讨论(0)
  • 2020-12-30 20:27

    You can view the console of the device using Xcode Organizer. Screenshot of Organizer

    In Xcode 6, the "Devices" tab was removed from the Organizer into it's own window. To view the console log, you now have to click the tiny little triangle in the lower left-hand area of the device information.

    Xcode 6 iOS Device Console Log Example

    0 讨论(0)
  • 2020-12-30 20:30

    Alternative to Black Frogs answer, you can also use the integrated console from your mac directly without Xcode. All output is forwarded there. Just do a spotlight search (CMD + Space) and type in console.

    0 讨论(0)
  • 2020-12-30 20:31

    As of Xcode 6.3.1, I couldn't find the log in any of the above locations when running the Allocations instrument. For me, in iOS Simulator (not Xcode), click Debug -> Open System Log... to get the NSLog messages normally appearing in Xcode. In case you need it, this log is kept in Library/Logs/CoreSimulator/[device name]/system.log. To get [device name], go to Xcode, Window -> Devices and find the device that you are currently simulating. Look for the Identifier. Compare that against the folder names in Library/Logs/CoreSimulator and you should find a match.

    0 讨论(0)
提交回复
热议问题