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.

  • 相关阅读:
    nginx能访问html静态文件但无法访问php文件
    LeetCode "498. Diagonal Traverse"
    LeetCode "Teemo Attacking"
    LeetCode "501. Find Mode in Binary Search Tree"
    LeetCode "483. Smallest Good Base" !!
    LeetCode "467. Unique Substrings in Wraparound String" !!
    LeetCode "437. Path Sum III"
    LeetCode "454. 4Sum II"
    LeetCode "445. Add Two Numbers II"
    LeetCode "486. Predict the Winner" !!
  • 原文地址:https://www.cnblogs.com/dengchaojie/p/7903751.html
Copyright © 2011-2022 走看看