Libc++abi.dylib:terminate_handler unexpectedly error

Source: Internet
Author: User

http://my.oschina.net/ioslighter/blog/384328

When you test your app today, you see a mandatory exception, and when you open a page that you clicked before logging in successfully, the following log is printed in the Xcode console:

Nsscanner:nil string argument
Nsscanner:nil string argument
Libc++abi.dylib:terminate_handler unexpectedly threw an exception

Then the app will crash out.

Search the relevant information, learned that the occurrence of nsscanner:nil string argument problem is related to the string, is generally considered to be intwithstring: The parameter passed nil will appear this problem. However, there are not several intwithstring in the Code of the project: the place where each breakpoint is added eliminates the possibility of the problem.

Then I single-step debug, and found the problem may be in these lines of code:
Nsdictionary *para=nil;
[Email protected] {@ "userid": [Configs Getinstance].me.uid, @ "flag": @ "1"};

Then the most problematic may be here: [Configs Getinstance].me.uid, will it be nil when it appears above the crash problem? It is verified that the UID value is nil before the advent of crash, and is the pit left by the predecessors ... Some adjustments have been made to the code to resolve this issue.

20150411 Update:

Nsscanner:nil string argument the problem is probably because you are using the Friend League SDK in the project, such error message is very bad for positioning, you can first put the code of the Union SDK to comment out the problem to locate.

20151119 Update:

This article Libc++abi.dylib:terminate_handler unexpectedly threw an exception error summary provides some analysis of this problem:

Now the only point of information is Libc++abi.dylib, What exactly does this library do? From the suffix view, is a dynamic library, then will it be because of some dynamic errors? By experience, the general dynamic error is basically due to the dynamic type error, in the Object-c language, the possibility of a dynamic type error can exist in the transformation between the immutable type and the mutable type, then our error-checking scope will be limited to the immutable type and the variable type conversion, Are we modifying a immutable type? Of course, the compiler is not so silly, if directly to an immutable type modification operation, will be directly error, then there is another possibility, the program assigns an immutable type to a mutable type, and then modifies the mutable type, which can be checked by static, but dynamically run, A type error occurs. Based on the above analysis, we can track breakpoints, we will find that the program in the Mutable object to add, set and other operations, and this object is actually assigned to an immutable object. A common case is to assign a Nsarray object to a Nsmutablearray object, then delete, add, and so on, or assign a Nsdictionary object to a Nsmutabledictionary object. Then the set and other operations are performed.

However, I encountered this problem today, one-step debugging found that crash occurred in Dequeuereusablecellwithidentifier: method here. Positioning to the last found in the code to a iboutlet renamed, but xib in the name before the Iboutlet still exist, remove the name before the Iboutlet to solve the problem.

20151203 Update:

Encountered this error:

-[__nsarrayi length]: Unrecognized selector sent to instance 0x1686d110

[; Libc++abi.dylib:terminate_handler unexpectedly threw an exception

Under normal circumstances with Xcode debug is not see this occurs crash location, only know that a string into the Nsarray it? How to quickly locate it, unplug the data cable, reproduce the crash again, then connect the data cable, select Window--devices on the Xcode menu, find the device name in the list on the left, click on its right view device Logs, navigate to the crash log that just happened, Click the right button to select Re-symbolicate log, wait a moment you can parse the crash log, this time it is easy to see crash occurred code line.

Reference:

UITableView deleted when the crash Nsscanner:nil string argument

The debug output area of Xcode 5 continuously outputs Nsscanner:nil string argument

Nsscanner:nil string argument error debugging Scheme

Libc++abi.dylib:terminate_handler unexpectedly error

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.