您的位置:首页 > 其它

bug1:unrecognized selector sent to instance

2016-01-17 19:25 465 查看
在自己的实际开发中,会遇到这样一个情况unrecognized selector sent to instance 。

在不打全局断点的情况下,会报这样的错误:

[;[fg245,21,53;2016-01-15 17:51:25:492TuNiuApp[30852:293034] Request(requestId:1034) failed with error{ErrorDomain=com.tuniu.httpResponseError Code=710003 "The operation couldn’t becompleted. 参数错误" UserInfo=0x7f8abe8eb900{NSLocalizedFailureReason=参数错误}}

[;[fg56,230,101;2016-01-15 17:51:28:163TuNiuApp[30852:293034] uploadUnreadMessageToServer error ErrorDomain=com.tuniu.httpResponseError Code=710003 "The operation couldn’t becompleted. 参数错误" UserInfo=0x7f8abe8eb900{NSLocalizedFailureReason=参数错误}

[;2016-01-15 17:51:28.167 TuNiuApp[30852:293034]-[TNHotelBookPriceDetailViewControllershowInViewController:withModel:coupon:goods:promotion:cashBack:orderBack:]:unrecognized selector sent to instance 0x7f8abeb699b0

libc++abi.dylib: terminate_handler unexpectedly threwan exception

 

 

 在调试台,输入bt命令,查看程序崩在哪里

(lldb) bt

* thread #1: tid =0x478aa, 0x0000000111a44286 libsystem_kernel.dylib`__pthread_kill + 10, queue ='com.apple.main-thread', stop reason = signal SIGABRT

    frame#0: 0x0000000111a44286 libsystem_kernel.dylib`__pthread_kill + 10

    frame#1: 0x0000000111a779f9 libsystem_pthread.dylib`pthread_kill + 90

    frame#2: 0x00000001117e419a libsystem_sim_c.dylib`abort + 129

    frame#3: 0x00000001115cf481 libc++abi.dylib`abort_message + 257

    frame#4: 0x00000001115f4b25 libc++abi.dylib`std::__terminate(void (*)()) + 44

    frame#5: 0x00000001115f47aa libc++abi.dylib`__cxa_rethrow + 99

    frame#6: 0x0000000111028d2c libobjc.A.dylib`objc_exception_rethrow + 40

    frame#7: 0x000000010d11b41e CoreFoundation`CFRunLoopRunSpecific + 654

    frame#8: 0x0000000111f5da3e GraphicsServices`GSEventRunModal + 161

    frame#9: 0x000000010f6748c0 UIKit`UIApplicationMain + 1282

  * frame #10:0x00000001061b23b7 TuNiuApp`main(argc=1, argv=0x00007fff59b99320) + 135 atmain.m:17

    frame#11: 0x000000011173c145 libdyld.dylib`start + 1

 

勾选上全局断点:

(lldb) bt

* thread #1: tid =0x480c7, 0x0000000118a14b8a libobjc.A.dylib`objc_exception_throw, queue ='com.apple.main-thread', stop reason = breakpoint 1.3

    frame#0: 0x0000000118a14b8a libobjc.A.dylib`objc_exception_throw

    frame#1: 0x0000000114be60ad CoreFoundation`-[NSObject(NSObject)
doesNotRecognizeSelector:] +205

    frame#2: 0x0000000114b3c13c CoreFoundation`___forwarding___ + 988

    frame#3: 0x0000000114b3bcd8 CoreFoundation`__forwarding_prep_0___ + 120

  * frame #4:0x000000010dc948c4 TuNiuApp`-[TNHotelBookCashPayViewControllershowPriceDetail](self=0x00007f83b2c41600, _cmd="showPriceDetail") +2244 at TNHotelBookCashPayViewController.m:1767

    frame#5: 0x000000010dc89b4b TuNiuApp`__68-[TNHotelBookCashPayViewControllertableView:cellForRowAtIndexPath:]_block_invoke(.block_descriptor=<unavailable>,show=YES) + 75 at TNHotelBookCashPayViewController.m:923

    frame#6: 0x000000010f8a9f91 TuNiuApp`-[TNHotelBookCashPayTitleCellbreakfastButtonPressed:](self=0x00007f83b648aa60,_cmd="breakfastButtonPressed:", sender=0x00007f83b648fcc0) + 145 atTNHotelBookCashPayTitleCell.m:101

    frame#7: 0x0000000117061d62 UIKit`-[UIApplication sendAction:to:from:forEvent:] + 75

    frame#8: 0x000000011717350a UIKit`-[UIControl _sendActionsForEvents:withEvent:] +467

    frame#9: 0x00000001171728d9 UIKit`-[UIControl touchesEnded:withEvent:] + 522

    frame#10: 0x000000011740c8b0 UIKit`_UIGestureRecognizerUpdate + 9487

    frame#11: 0x00000001170ae646 UIKit`-[UIWindow _sendGesturesForEvent:] + 1041

    frame#12: 0x00000001170af272 UIKit`-[UIWindow sendEvent:] + 666

    frame#13: 0x0000000117075541 UIKit`-[UIApplication sendEvent:] + 246

    frame#14: 0x0000000117082cdc UIKit`_UIApplicationHandleEventFromQueueEvent + 18265

    frame#15: 0x000000011705d59c UIKit`_UIApplicationHandleEventQueue + 2066

    frame#16: 0x0000000114b12431CoreFoundation`__CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17

    frame#17: 0x0000000114b082fd CoreFoundation`__CFRunLoopDoSources0 + 269

    frame#18: 0x0000000114b07934 CoreFoundation`__CFRunLoopRun + 868

    frame#19: 0x0000000114b07366 CoreFoundation`CFRunLoopRunSpecific + 470

    frame#20: 0x0000000119949a3e GraphicsServices`GSEventRunModal + 161

    frame#21: 0x00000001170608c0 UIKit`UIApplicationMain + 1282

    frame#22: 0x000000010db9e3b7 TuNiuApp`main(argc=1, argv=0x00007fff521ad320) + 135 atmain.m:17

    frame#23: 0x0000000119128145 libdyld.dylib`start + 1

4000

 

且全局断点崩在如下代码:



 

且在下面报了这样一个错误:方法未实现(在编译的时候不会报错,只有在运行的时候才会报错!!)


 

最后发现如下:

在implementation中这样写得:



 

在interface中这样写得:



 

修改好了,程序运行正常:

内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: