tags:

views:

51

answers:

1

I am getting this warning for the line code:

Class myClass = objc_lookUpClass([_className UTF8String]);

I am adding

#import <Foundation/NSObjCRuntime.h>
#import <objc/objc.h>

And it still don't resolve the problem

Another warning i get on this line is: "Initialization makes pointer from integer without a cast"

+3  A: 

If you check the doc, you'll see that objc_lookUpClass returns an id, not a Class. To suppress the warning you either need to make myClass an id, or cast the return value to a Class:

Class myClass = (Class)objc_lookUpClass([_className UTF8String]);

BTW, there is NSClassFromString if you have an NSString.

Class myClass = NSClassFromString(_className);
KennyTM