How can I check if an object in an NSArray is NSNull?

后端 未结 9 1819
忘了有多久
忘了有多久 2020-12-23 18:50

I am getting an array with null value. Please check the structure of my array below:

 (
    \"< null>\"
 )

When I\'m trying to access

9条回答
  •  野趣味
    野趣味 (楼主)
    2020-12-23 19:31

    Building off of Toni's answer I made a macro.

    #define isNSNull(value) [value isKindOfClass:[NSNull class]]
    

    Then to use it

    if (isNSNull(dict[@"key"])) ...
    

提交回复
热议问题