I want to create a NSDictionary with +[NSDictionary dictionaryWithObjectsAndKeys:]. One of my keys has a string but the string can sometimes be nil
. If the string is nil
, any other value key pairs I put afterward will be ignored because the list is prematurely terminated. What is the standard way to deal with the possibility that there might be a value with nil
in a NSDictionary
?
You need to check if the string is null. If it is, add [NSNull null]
instead of your string.