Xcode4 使用 Organizer 分析 Crash logs

一.四种崩溃类型

  • 程序崩溃: 可能是最常见的,经常发生于内存访问出错,异常,或者其他的程序错误

  • 内存不足: 系统因为没有足够的内存满足程序需求从而杀死程序出现这种日志.它不同于其他日志的是它没有程序各线程的堆栈信息. Rather than be concerned about what part of your code was executing at the time of termination, you should investigate your memory usage patterns and your responses to low memory warnings. Memory usage of each process is reported in terms of number of memory pages, which as of this writing are 4KB each.

  • 强制退出:异常代码 0xdeadfa11. 这出现在用户在程序界面按下关机键知道出现"移动滑块关机",然后长按Home键.用户之所以这么做,很可能因为你的程序无响应,当然也不一定.

  • 响应超时: 异常代码 0x8badf00d

    . 出现在程序启动慢,运行慢,响应慢.

      

除了内存不足,其他日志都包含终止时各线程的堆栈信息.

二.分析1.建立一个文件夹,存放你编译到手机上的.app和对应的.dSYM文件.(喜欢放桌面,home目录的跳过)终端输入命令

mdimport "你刚刚建的文件夹目录"

这时为了确保目录在spotlight索引目录里.

2.编译app到你的手机上,同时存储当时生成的.app和.dSYM到刚刚创建的文件夹(同一文件夹,不要改名)

3.狂乱操作你的手机吧,出错了,xcode4打开organizer,点击崩溃日志,看看,不是以前那种冏来冏去的地址代码了吧,有出错的函数名称,位置等.调试改错吧.(针对第二种错误报告)

三.得到崩溃日志

联机后,崩溃日志会被iTunes拷贝,各平台下日志目录如下:

  • Mac OS X: ~/Library/Logs/CrashReporter/MobileDevice/<DEVICE_NAME>

  • Windows XP: C:\Documents and Settings\<USERNAME>\Application Data\Apple Computer\Logs\CrashReporter\MobileDevice\<DEVICE_NAME>

  • Windows Vista or 7: C:\Users\<USERNAME>\AppData\Roaming\Apple Computer\Logs\CrashReporter\MobileDevice\<DEVICE_NAME>

<USERNAME> 电脑用户名 <DEVICE_NAME> ios设备名称

参考:http://developer.apple.com/library/ios/#technotes/tn2151/_index.html

Xcode Organizer可以直接获得这些错误报告.

附:mac中dwarfdump命令可以产看app以及dSYM文件的UUID,可以确定crash log与之是否对应.

补充:

symbolicatecrash工具

查看这个工具的帮助命令行:

$ symbolicatecrash -h


usage:

    symbolicatecrash [-Ah] LOGFILE [SYMBOL_PATH ...]

    Symbolicates a crashdump LOGFILE which may be "-" to refer

  to stdin. By default, all heuristics will be employed

  in an attempt to symbolicate all addresses. Additional

  symbol files can be found under specified directories.

Options:

    -A  Only symbolicate the application, not libraries

    -h  Display this message

    -v  Verbose

To add symbols to the crash log you need the dSYM file generated by the linker when you compiled your application for AppStore. In other words, when you build for AppStore you should keep the dSYM package in a safe place backed up by Time Machine. This is very important. You should keep a copy of the dSYM for each version of your application ever shipped. If you have the package, translating code offsets to function names with line numbers has never been easier:

$ symbolicatecrash report.crash MobileLines.app.dSYM > report-with-symbols.crash

这个工具可以和上面的互相补充着使用,更加全面了

转载于:https://www.cnblogs.com/v2m_/archive/2011/08/16/2141337.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
使用Xcode模拟器,您可以按照以下步骤进行操作: 1. 首先,确保您已经安装了Xcode。如果还没有安装,请前往App Store搜索并下载安装。 2. 打开Xcode应用程序,在主界面上选择“Window”菜单,然后选择“Devices and Simulators”(设备和模拟器)。 3. 在“Devices and Simulators”窗口中,您可以看到连接到计算机的设备和已安装的模拟器。如果您的设备已连接到计算机,请在左侧的“Devices”(设备)选项卡下查看设备列表。如果您想使用模拟器,请切换到右侧的“Simulator”(模拟器)选项卡。 4. 在模拟器选项卡中,您可以选择不同的iOS版本和设备类型来模拟。根据您的需求,选择适当的iOS版本和设备类型。 5. 一旦您选择了特定的iOS版本和设备类型,您可以单击右下角的“+”按钮来添加新的模拟器。根据您的需求,选择适当的设备和版本,然后单击“Create”(创建)按钮。 6. 模拟器将被创建并显示在模拟器列表中。您可以双击模拟器以启动它,或者单击“Run”(运行)按钮来运行您的应用程序或项目。 请注意,您还可以使用第三方工具,如Control Room,来控制和管理模拟器的外观和状态栏。您可以在Mac App Store搜索并下载Control Room应用程序,然后按照其提供的指南进行安装和使用。请确保您的macOS版本符合Control Room的要求。 如果您在使用Xcode模拟器时遇到问题,例如无法创建模拟器或macOS版本过高等,您可以尝试一些解决方案。例如,您可以打开Xcode的原始文件,找到Info.plist文件,并进行相应的修改。具体的修改步骤可以参考引用中提供的解决方案。 希望这些信息对您有所帮助!<span class="em">1</span><span class="em">2</span><span class="em">3</span> #### 引用[.reference_title] - *1* *3* [xcode使用教程](https://blog.csdn.net/weixin_43929884/article/details/124321277)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"] - *2* [一个MacOS应用程序,用于控制Xcode Simulator。-Swift开发](https://download.csdn.net/download/weixin_42131705/19109723)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"] [ .reference_list ]

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值