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.

  • 相关阅读:
    js动态生成表格
    My97DatePicker显示时间控件的使用方法
    理解Action,Service和Dao功能(转)
    Myeclipseforspring 10破解
    MySQL常用命令(参考资料,部分改动)
    Struts2---Result(传统Web应用程序与Ajax应用程序的异同)
    正则表达式笔记
    day5.字符串内置函数
    day5.数据类型简介
    day4.变量+程序交互
  • 原文地址:https://www.cnblogs.com/dengchaojie/p/7903751.html
Copyright © 2011-2022 走看看