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.

  • 相关阅读:
    C#线程同步lock,Monitor,Mutex,同步事件和等待句柄(1)
    多线程 C#解决方案小结
    10款交互设计原型开发工具
    创建自定义配置节
    禁用外键 oracle
    GUIDESIGNSTUDIO3中文帮助(1)欢迎使用 GUI Design Studio 3.0
    大数据量的数据库设计思考
    gui design studio 3 中文帮助(2)获取帮助
    NHibernate之旅(24):探索NHibernate二级缓存(下)(转)
    客户端原型GUI Design Studio
  • 原文地址:https://www.cnblogs.com/dengchaojie/p/7903751.html
Copyright © 2011-2022 走看看