Ios dlopen for dylib.framework

Ios dlopen for dylib.framework,ios,dylib,Ios,Dylib,我正在为企业应用程序做准备,我正在研究dlopen,因为我需要下载代码并在运行时运行。(如子模块) 我开始对此感到困惑,因为一些open.dylib和一些open.framework 我尝试从资源目录加载,hModule总是为零 NSString *dlPath = @"StaticLibrary.dylib";//i try with complete path and it is not okay also const char* cdlpath = [dlPath UTF8Strin

我正在为企业应用程序做准备,我正在研究dlopen,因为我需要下载代码并在运行时运行。(如子模块)

我开始对此感到困惑,因为一些open.dylib和一些open.framework

我尝试从资源目录加载,hModule总是为零

NSString *dlPath = @"StaticLibrary.dylib";//i try with complete path and it is not okay also

const char* cdlpath = [dlPath UTF8String];
void* hModule = dlopen(cdlpath, RTLD_LAZY);
我从url下载,也尝试这样做

    const char *cString = [filePath cStringUsingEncoding:NSASCIIStringEncoding];

    void *uikit = dlopen(cString, RTLD_GLOBAL);
    id (*FunctionName)() = dlsym(uikit, "helloWorldFromStaticLibrary");
    FunctionName();
    dlclose(uikit);
    //my cString is "/Users/khantthulinn/Library/Developer/CoreSimulator/Devices/04F2B44A-B78E-4400-98B7-EF6AA8352646/data/Containers/Data/Application/63E7D709-F140-4AF1-A4F5-475454B347FE/Library/Caches/StaticLibrary.dylib"

我只是不知道为什么我的dlopen总是为零。stackoverflow的一些人说我需要用相同的证书签名。我也试过了。但这不好。我该怎么办?

dlopen()
失败时,
dlerror()告诉您什么?我可以这样记录吗?const char*dlErr=dlerror();如果(uikit==NULL){…}
,则在
中。是这样的。我现在看到了这个。dlopen(/Users/khantthulinn/Library/Developer/CoreSimulator/Devices/04F2B44A-B78E-4400-98B7-EF6AA8352646/data/Containers/data/Application/EE454318-5521-49CE-80E6-2DF3361B209E/Library/Caches/StaticLibrary.dylib,8):未找到合适的映像。确实找到:\n\t/Users/khantthulinn/Library/Developer/CoreSimulator/Devices/04F2B44A-B78E-4400-98B7-EF6AA8352646/data/Containers/data/Application/EE454318-5521-49CE-80E6-2DF3361B209E/Library/Caches/StaticLibrary.dylib:未知文件类型,前八个字节:0x20 0x3C 0x21 0x44 0x4F 0x43 0x54 0x59“OK,这就是你的答案。该文件不是动态库;它是一个启动
”的文件