swift中直接使用NSClassFromString 獲取的Class是nil,必須要在類型字符串加入App的執(zhí)行文件名∪先唬“App的執(zhí)行文件名.類型字符串”
Class MyClassFromString(NSString *className) {
Class c = NSClassFromString(className);
if (c) return c;
NSString *namespace = [[NSBundle mainBundle] infoDictionary][@"CFBundleExecutable"];
c = NSClassFromString([NSString stringWithFormat:@"%@.%@", namespace, className]);
return c;
}