nil : 指向oc对象的空指针
Nil : 指向oc类的空指针
NULL : 一般赋值给nil之外的其他空值。如SEL,基本类型的空指针等;
[NSApp beginSheet:sheet
modalForWindow:mainWindow
modalDelegate:nil //pointing to an object
didEndSelector:NULL //pointing to a non object/class
contextInfo:NULL]; //pointing to a non object/class
NSNull : 在集合对象中表示空值的对象。 NSNull只有一个方法:+ (NSNull *) null;
[NSNull null]用来在NSArray和NSDictionary中加入非nil(nil表示列表结束)的空值. [NSNull null]是一个对象,他用在不能使用nil的场合。
看一段解释:
nil -> Null-pointer to objective- c object
NIL -> Null-pointer to objective- c class
null-> null pointer to primitive type or absence of data.
例子:
NSURL * url = nil;
Class class = Nil;
int *pointer = NULL;
若obj为nil, [ obj message ]将返回NO,而不是NSException 若obj为NSNull,将抛出异常NSException.
详细内容请看:http://blog.youkuaiyun.com/xdrt81y/article/details/8981133