ios NSString crash

Recently encountered an exception, and solved a bit.

exception description:

Application Specific Information:
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[__NSCFString rangeOfString:options:range:locale:]: nil argument' terminating with uncaught exception of type NSException abort() called

First we look at the wrong reason, and then the corresponding code to find where it will go wrong, view the description of the method.
Solution:
NSString method "containsString:"
Declaration
-(BOOL)containsString:(NSString *)str;
Parameters
str -> The string to search for. This value must not be nil.
Return Value -> YES if the receiver contains str, otherwise NO.

成功的三大原则: 1、坚持 2、不要脸 3、坚持不要脸
原文地址:https://www.cnblogs.com/xulinmei/p/7421297.html