Questions tagged «nsnull»

16
什么时候在Objective-C中使用nil和NULL?
这是示例代码: NSDictionary *myDictionary = [NSDictionary dictionary]; NSNumber *myNumber = [myDictionary valueForKey: @"MyNumber"]; NSLog(@"myNumber = %@", myNumber); // output myNumber = (null) if (myNumber == nil) NSLog(@"test 1 myNumber == nil"); if (myNumber == NULL) NSLog(@"test 2 myNumber == NULL"); if ([myNumber isEqual:[NSNull null]]) NSLog(@"test 3 myNumber == [NSNull null]"); 什么时候应该使用nil,NULL和[NSNull …
170 objective-c  null  nsnull 

6
Objective-C中nil,NIL和null之间的差异
我想知道的区别nil,NIL和null。我四处搜寻,发现了这一点: nil ->指向Objective-C对象的空指针 NIL ->指向Objective-C类的空指针 null ->指向原始类型或没有数据的空指针 但是我无法清楚地理解术语“ Objective-C对象”和“类”。 请给我解释一下。此外,有没有像任何文字NSNull或NSNil在Objective-C?如果是这样,请说明其用途。
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.