我有这个代码,需要将它移植到弧,但我不知道如何:
case FIELDTYPE_OBJECT:
className = [fieldType substringWithRange:NSMakeRange(2, [fieldType length]-3)];
rel = class_createInstance(NSClassFromString(className), sizeof(unsigned));
Class theClass = [rel class];
if ([rel isKindOfClass:[DbObject class]]) {
//Load the record...
NSInteger Id = [rs intForColumn:[theClass relationName]];
if (Id==0) {
fieldValue = [rel init];
} else {
Db *db = [Db currentDb];
fieldValue = [db loadById: theClass theId:Id];
}
}
break;
Run Code Online (Sandbox Code Playgroud)
错误是:
error: 'class_createInstance' is unavailable: not available in automatic reference counting mode
Run Code Online (Sandbox Code Playgroud)
怎么更换它?
我需要在运行时构建类对象.