一、參數(shù)為空的bug
nil argument- 參數(shù)為空導(dǎo)致!
一個(gè)錯(cuò)誤澳窑,坑我太久傲底贰!J锬簟晦炊!
傷不起!原來(lái)是傳參數(shù)A宁脊,A參數(shù)為空6瞎!榆苞!
一定要謹(jǐn)慎拔瘸摹!做參數(shù)判斷W1【巍!
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[NSPlaceholderString initWithString:]: nil argument'
*** First throw call stack:
(0x35a5788f 0x37dfe259 0x35a57789 0x35a577ab 0x354ff4c9 0x39756f 0x398137 0x39b5a3 0x354e6a81 0x3557a591 0x32e1a735 0x32e1a5f0)
terminate called throwing an exceptionterminate called throwing an exception(lldb)
二赊琳、容錯(cuò)處理
// 對(duì)字符串做特殊的宏输涕,即保證返回的值不為空
#define ISNIL(x) ((x) == nil ? @"" : (x))
#define ISNILDefault(x, y) ((x) == nil ? y : (x))
#define ISNULL(x) ((x) == nil || [(x) isEqualToString:@"NULL"] || [(x) isEqualToString:@"null"] ? @"" : (x))