调用dylib方法时,无法识别的选择器被发送到实例

时间:2012-04-25 13:14:19

标签: macos cocoa dylib

我有以下代码来加载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

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

0 个答案:

没有答案