3 ms·
You could use it to test whether or not you really got a class from NSClassFromString(). For instance: Class _myClass; // aClassName was previously defined
by mmariani 14y ago
You could use it to test whether or not you really got a class from NSClassFromString(). For instance:
Class _myClass;
// aClassName was previously defined
if((_myClass = NSClassFromString(aClassName)) == Nil)
[NSException raise:@"InvalidClass"
reason:@"Unknown class named %@.", aClassName);
id myObj = [[_myClass alloc] init];
[myObj whatever];
- scrumper 14y agoMakes sense, thanks.