ios - Is it safe trying to get an object for a key that doesn't exist? -
i'm new objective c , there's seems work makes me uneasy, , that's this.
pfobject *templateobject = [templateobjectid objectforkey:@"gameunittemplate"]; if(templateobject != nil ) { the point being in versions of templateobjectid object there no gameunittemplate, it's class altogether, safe way of checking whether gameunittemplate exists or not?
it safe, assuming templateobjectid nsdictionary (or sub-class). you'll nil back. documented:
parameters: akey : key return corresponding value.
return value: value associated akey, or nil if no value associated akey.
Comments
Post a Comment