Object-C中nil, NULL和NSNull
控制处理不当是引起程序错误乃至崩溃的重要原因之一。
因为Object-C的集合对象,如NSArray、NSDictionary、NSSet等,都有可能包含NSNull对象,所以,如果一下代码中的item为NSNull,则会引起程序崩溃。
person=nil;[person castBallot];NSLog("person=%@",person);