Convert a string (“MyExampleClass”) into a class name (MyExampleClass)

Here’s what you’d want:

Class theClass = NSClassFromString(classNameStr);
id myObject = [[theClass alloc] init];

Note that you can’t use theClass as a type name (i.e. theClass *myObject). You’ll have to use id for that.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)