I am doing for enterprise app and I am studying about dlopen because I need to download code and run in runtime. (like sub-module).
Download and execute iOS code dynamically at runtime
I start to confuse about that because some open .dylib and some open .framework.
I try to load from resource directory and hModule is always nil.
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);
I download from url and try like this too.
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"
I just don't know why my dlopen is always nil. Some people in stackoverflow said that I need to sign with same certificate. I have tried also. But it is not okay. How shall I do?