3

我有以下代码来加载 dylib:

void* lib_handle = dlopen("./newCocoaLib.dylib", RTLD_LOCAL);
if (!lib_handle) {
    exit(EXIT_FAILURE);
}


// Get the Person class from newCocoaLib.dylib.
Class Person_class = NSClassFromString(@"newCocoaLib");
if (!Person_class) {
    exit(EXIT_FAILURE);
}

id personObj = [Person_class new];
//calling the method of newCocoaLib of newCocoaLib.dylib
[personObj displayNameFromNewCocoaLib];//unrecognized selector sent to instance

可能是什么问题?有任何想法吗?

4

0 回答 0