zoukankan      html  css  js  c++  java
  • NSNull与nil

        NSDictionary *dictNull = @{@"key":[NSNull null]};

     

        NSDictionary *dictNil = @{@"key":nil};//Collection element of type 'void *' is not an Objective-C object

     

     

     

     

     

        NSMutableDictionary *dict = [NSMutableDictionary dictionary];

        [dict setValue:nil forKey:@"keyNil"];

        [dict setObject:[NSNull null] forKey:@"keyNull"];

    /* Send -setObject:forKey: to the receiver, unless the value is nil, in which case send -removeObjectForKey:.

    */

    - (void)setValue:(nullable ObjectType)value forKey:(NSString *)key;

     

     

    - (void)setObject:(ObjectType)anObject forKey:(id<NSCopying>)aKey;

    Important

    Raises an NSInvalidArgumentException if anObject is nil. If you need to represent a nil value in the dictionary, use NSNull.

  • 相关阅读:
    杭电ACM 1297 Children’s Queue
    杭电ACM 1297 Children’s Queue
    Delta-wave
    
    <MySQL>MySQL创建表及相关约束
    <MySQL>MySQL的基本操作(增,删,改)
    <MySQL>MySQL的安装及安装中存在的问题
    <python>python中拷贝的问题
    <python>简单的学生管理系统V1.0
    <python>编写装饰器,为多个函数加上记录调用功能,要求每次调用函数都将被调用的函数名称写入文件
  • 原文地址:https://www.cnblogs.com/dengchaojie/p/7903751.html
Copyright © 2011-2022 走看看