如何从 iOS 模拟器获取控制台日志? [英] How can I get the console logs from the iOS Simulator?

查看:16
本文介绍了如何从 iOS 模拟器获取控制台日志?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I want to see what happens in the iOS Simulator if I'm not testing the app in Xcode.

例如,如果我在 Safari 模拟器中打开一个链接,看看控制台中会发生什么,或者如果我安装了一个网络应用程序,请查看我在控制台中按下的链接.

For example, if I open a link in the Safari simulator, see what happens in the console, or if I install a web-app, see the links that I'm pressing in console.

我该怎么做?

我想在 Xcode 或终端中看到它,但如果我需要使用其他软件也没有问题.

I want to see it in Xcode or Terminal, but it's not a problem if I need to use another bit of software.

推荐答案

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

iOS Simulator > Menu Bar > Debug > Open System Log

老办法:

iOS Simulator 将其日志直接打印到标准输出,因此您可以看到日志与系统日志混合在一起.

iOS Simulator prints its logs directly to stdout, so you can see the logs mixed up with system logs.

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

然后运行模拟器.

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

This stopped working on Mavericks/Xcode 5. Now you can access the simulator logs in its own folder: ~/Library/Logs/iOS Simulator/<sim-version>/system.log

您可以使用 Console.app 来查看这个,或者只是做一个尾巴(例如 iOS 7.0.3 64 位):

You can either use the Console.app to see this, or just do a tail (iOS 7.0.3 64 bits for example):

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

这篇关于如何从 iOS 模拟器获取控制台日志?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆