IOS调试技巧-崩溃定位


      如果你的程序崩溃了,而你又恰好没有捕获异常,那么你的控制台可能会输出如下内容:


2013-03-13 13:30:10.186 Picross[43233:1303] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[AppDelegate crash]: unrecognized selector sent to instance 0xc04de10'*** First throw call stack:
(0x355b012 0x32ffe7e 0x35e64bd 0x354abbc 0x354a94e 0x3313663 0x12f54 0x3f0153f 0x3f13014 0x3f042e8 0x3f04450 0x926b5e12 0x9269dcca)
libc++abi.dylib: terminate called throwing an exception
    
你可能会比较困惑到底程序中哪段代码导致的崩溃。直接在First throw call stack中找‘最小’的地址值,然后用lldb来找这个地址值的符号:

im loo -a 0x12f54

    这时你会得到相应的调用函数和行号:

Address: Picross[0x00012f54] (Picross.__TEXT.__text + 67540)
Summary: Picross`__57-[AppDelegate application:didFinishLaunchingWithOptions:]_block_invoke112 + 52 at AppDelegate.m:216

    通常这里就是代码中产生崩溃的地方


原文:http://fivelakesstudio.blogspot.com/2013/03/cocoa-debugging-tip.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值