Cocoa: Getting the class of an attribute using a string


ok may sound bit wired, creating application/framework needs convert xml appropriate data type in objective-c class.

code:
  if([ [dictionary objectforkey:key] iskindofclass: [nsstring class]]==yes ) 			 {				 //set variable } 		 if([ [dictionary objectforkey:key] iskindofclass: [nsnumber class]]==yes ) {  //set variable  } 			 
[dictionary objectforkey:key]
returns name of attribute going updated, string self, above comparison string. need actual class of attribute , cant find way of doing it, have ideas ?
 

i may oversimplifying this, don't have defined name each type in xml? example have things in dictionary like:
number
string
realnumber

seems need isequaltostring: , compare nsstring literals find type is. alternately, build own dictionary keys nsstrings appear in xml, , values class you'd like. pass nsstring objectforkey, , result class you'd use.

if doesn't cover you're trying do, might want explain bit more.

-lee
 


Forums Macs Mac Programming


  • iPhone
  • Mac OS & System Software
  • iPad
  • Apple Watch
  • Notebooks
  • iTunes
  • Apple ID
  • iCloud
  • Desktop Computers
  • Apple Music
  • Professional Applications
  • iPod
  • iWork
  • Apple TV
  • iLife
  • Wireless

Comments

Popular posts from this blog

Upgrade Eligibility?

need help with itunes 7.7

How to change Apple IDs on iPhones