ios 使用仪器时如何从控制台应用程序查看 NSLog()
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/5569134/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to see NSLog() from console app when using instruments
提问by prostock
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. I can't seem to spot any of them. After you open the Console App, where would you look?
我正在使用分配工具,但想查看我的 NSLog 消息。在另一篇文章中,他们提到要查看 /Applications/Utilities/Console 中的消息。我似乎无法发现其中任何一个。打开控制台应用程序后,您会在哪里查看?
回答by Black Frog
You can view the console of the device using Xcode Organizer.
您可以使用 Xcode 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 中,“设备”选项卡已从管理器中移除到它自己的窗口中。要查看控制台日志,您现在必须单击设备信息左下方区域中的小三角形。
回答by denbec
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.
作为 Black Frogs 答案的替代方案,您还可以在没有 Xcode 的情况下直接从您的 mac 使用集成控制台。所有输出都在那里转发。只需进行聚光灯搜索(CMD + Space)并输入控制台。
回答by Klaas
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
如果要使用控制台应用程序,可以在日志列表中的文件部分下找到 Xcode 日志(如果不可见:菜单 -> 查看 -> 显示日志列表)。寻找
~/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...'.
一些较新版本的 Xcode 中的另一个选项可以在 Xcode 的“调试”菜单中找到。查找条目“打开系统日志...”。
回答by dolios
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.
作为Xcode的6.3.1,运行分配仪器时,我无法找到日志以上任何位置。对我来说,在 iOS 模拟器(不是 Xcode)中,单击 Debug -> Open System Log... 以获取通常出现在 Xcode 中的 NSLog 消息。如果您需要,此日志保存在 Library/Logs/CoreSimulator/[设备名称]/system.log 中。要获取 [设备名称],请转到 Xcode,窗口 -> 设备并找到您当前正在模拟的设备。寻找标识符。将其与 Library/Logs/CoreSimulator 中的文件夹名称进行比较,您应该会找到匹配项。