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

Popular posts from this blog

jquery - How can I dynamically add a browser tab? -

node.js - Getting the socket id,user id pair of a logged in user(s) -

keyboard - C++ GetAsyncKeyState alternative -