iPhone模拟器生成的崩溃日志?
iPhone Simulator 是否有生成崩溃日志?
模拟器崩溃了很多,但没有在控制台中留下任何痕迹......崩溃日志会很有用。
Are there any crash logs generated by iPhone Simulator?
the Simulator crashes a lot but not leaving any traces in Console... the crash log will be useful.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(7)
控制台将显示模拟器中运行的应用程序的
NSLog()
输出。崩溃日志保存到文件中。我在我的主目录下找到了一些文件,
它们的文件扩展名为
.crash
我还没有弄清楚如何让它们生成,即使调试器获取了
EXC_BAD_ACCESS< /代码> 信号。
更新
目前,(OSX 10.11.6),
~/Library/Logs/DiagnosticReports
中的 .crash 日志是模拟器本身崩溃 。 应用程序崩溃的日志(但模拟器设备仍然运行良好)位于:每次崩溃时,都会有一个具有唯一 ID 的子文件夹。按日期排序,以便您最近的崩溃是第一个子文件夹。在其中,首先查看
stderr.log
和system.log
。另外,直接在
CoreSimulator
下查看CoreSimulator.log
和Simulator.log
。The console will show the
NSLog()
output from an app running in the simulator. The crash logs are saved to file.I have found some in my home directory under
They have a file extension of
.crash
Something I haven't yet figured out is how to get them to generate even if the debugger grabs the
EXC_BAD_ACCESS
signal.Update
Currently, (OSX 10.11.6), the .crash logs in
~/Library/Logs/DiagnosticReports
, are when the emulator itself crashes. Logs for an app crashing (but the emulator device is still running fine), are in:Per crash, there is a sub-folder with a unique id. Sort by date, so that your recent crash is the first sub-folder. Inside that, start by looking at
stderr.log
andsystem.log
.Also directly under
CoreSimulator
, seeCoreSimulator.log
andSimulator.log
.我非常确定您可以在“实用程序”中的 OS X 控制台应用程序中看到这一点。如果我错了,请务必投票给我,这样我就会删除它。
更新:
具体来说(从 OSX 10.11.6 开始),
当应用程序在模拟器上崩溃时,会向以下位置添加一个子文件夹(具有唯一的 id):
在其中,首先检查
stderr.log
和system.log
。当模拟器本身崩溃时,子文件夹将添加到:
不要将此路径与
(开始时缺少
~
),其中包含有关您的 mac 的不同报告。I am pretty sure that you can see this in the OS X Console app located in Utilities. If I'm wrong though, be sure to vote me the heck down so I delete this.
UPDATE:
Specifically (as of OSX 10.11.6),
When an app crashes on emulator, a subfolder (with a unique id) is added to:
Within that, start by examining
stderr.log
andsystem.log
.When the emulator itself crashes, a subfolder is added to:
Don't confuse this path with
(lacking
~
at start), which has different reports about your mac.这是在特殊情况下对我有用的东西......我的应用程序在终止时因 SIGKILL 崩溃。我会在 main.m 中看到异常几秒钟,然后应用程序将完成终止 - 因此,没有机会获得回溯。
我对“模拟器在哪里存储崩溃日志”进行了大量搜索,但从未找到答案。然而,以下技巧非常方便,我能够即时获取崩溃日志:
基本上,打开 /Applications/Utilities/CrashReporterPrefs.app 并将设置更改为“Developer”。这将导致 CrashReporter 在您的应用程序崩溃后显示带有崩溃日志的弹出窗口。
我在 Apple 文档的“查看 iOS 模拟器控制台和崩溃日志”部分中找到了这一点:
http://developer.apple。 com/library/ios/#documentation/Xcode/Conceptual/ios_development_workflow/125-Using_iOS_Simulator/ios_simulator_application.html
Here’s something that worked for me in a special case... My app was crashing with SIGKILL as it terminated. I would see the exception in main.m for a few seconds, and then the app would finish terminating – thus, no chance to get the back trace.
I did a lot of searching on “where does simulator store its crash logs” and never managed to find an answer. However, the following trick came in quite handy and I was able to grab the crash log on the fly:
Basically, open /Applications/Utilities/CrashReporterPrefs.app and change the setting to “Developer”. This will cause CrashReporter to display a popup with the crash log after your app crashes.
I found this in the “Viewing iOS Simulator Console and Crash Logs” section in this doc from Apple:
http://developer.apple.com/library/ios/#documentation/Xcode/Conceptual/ios_development_workflow/125-Using_iOS_Simulator/ios_simulator_application.html
崩溃崩溃日志将出现在 ~/Library/Logs/CrashReporter 下。
当 Xcode 从连接的设备获取崩溃日志时,它将它们存储在 ~/Library/Logs/CrashReporter/MobileDevice 的子文件夹中
The crash crash logs will appear under ~/Library/Logs/CrashReporter.
When Xcode gets crash logs from a connected device, it stores them in sub-folders of ~/Library/Logs/CrashReporter/MobileDevice
这要可靠得多。只需几个步骤,我就可以找到源代码行号&方法名称:
This is much more reliable. In only a few steps I was able to find the source line number & method name:
对我来说,这是我添加到调试器监视窗口中的表达式。当遇到断点时,错误的表达式会导致 XCode 出现段错误。
For me, it was an expression that I had added to the debugger watch window. When a breakpoint was getting hit, the bad expression was causing XCode to segfault.
您可能还想看看这个相关的答案:https://stackoverflow.com/a/14984297/679240
上述答案均不适用于“Big Sur”操作系统版本。查找日志的唯一方法是通过“控制台”应用程序(应用程序/实用程序/控制台)
You may also want to take a look at this related answer: https://stackoverflow.com/a/14984297/679240
None of the answers above worked on the "Big Sur" OS version. The only way to find the log was through the "Console" app (Application/Utilities/Console)