Warm tip: This article is reproduced from serverfault.com, please click

其他-如何从iOS模拟器获取控制台日志?

(其他 - How can I get the console logs from the iOS Simulator?)

发布于 2012-04-15 20:09:43

如果我没有在Xcode中测试应用程序,我想看看iOS模拟器中会发生什么。

例如,如果我在Safari模拟器中打开链接,请查看控制台中发生的情况,或者如果我安装了Web应用程序,请查看我在控制台中按的链接。

我怎样才能做到这一点?

我想在Xcode或Terminal中看到它,但是如果我需要使用其他软件也不是问题。

Questioner
user1335015
Viewed
0
45.1k 2017-01-05 07:36:36

iOS模拟器>菜单栏>调试>打开系统日志


老办法:

iOS Simulator将其日志直接打印到stdout,因此你可以看到日志与系统日志混合在一起。

打开终端并输入: tail -f /var/log/system.log

然后运行模拟器。

编辑:

这停止了​​在Mavericks / Xcode 5上的工作。现在,你可以在其自己的文件夹中访问模拟器日志: ~/Library/Logs/iOS Simulator/<sim-version>/system.log

你可以使用Console.app查看此内容,也可以只做一条尾巴(例如iOS 7.0.3 64位):

tail -f ~/Library/Logs/iOS\ Simulator/7.0.3-64/system.log

编辑2:

他们现在位于 ~/Library/Logs/CoreSimulator/<simulator-hash>/system.log

tail -f ~/Library/Logs/CoreSimulator/<simulator-hash>/system.log