tobefuturer/app2dylib

你好,dlopen执行打开就失败闪退,不知道什么原因,能帮看下吗

Opened this issue · 1 comments

main函数执行dlopen的代码:
NSLog(@"\n===Start===\n"); NSString * dylibName = @"myapp"; NSString * path = [[NSBundle mainBundle] pathForResource:dylibName ofType:@"dylib"]; NSLog(@"thePath=(%@)",path); void * libHandle = dlopen([path cStringUsingEncoding:NSUTF8StringEncoding], RTLD_NOW);

执行dlopen时闪退,错误日志如下:

objc[2351]: Class AppDelegate is implemented in both /var/containers/Bundle/Application/FD8D1781-C830-44E8-9E49-E656B08431C3/TestAppLoadDylib.app/TestAppLoadDylib and /var/containers/Bundle/Application/FD8D1781-C830-44E8-9E49-E656B08431C3/TestAppLoadDylib.app/myapp.dylib. One of the two will be used. Which one is undefined.
2018-08-16 18:23:02.683 TestAppLoadDylib[2351:109988] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[NSBundle initWithURL:]: nil URL argument'
*** First throw call stack:
(0x1812cadb0 0x18092ff80 0x1812cacf8 0x181c29338 0x181c292bc 0x102f21500 0x1809320cc 0x180932df0 0x1200d9d3c 0x1200e80c4 0x1200e7280 0x1200e7334 0x1200dd160 0x1200e2160 0x180d456a0 0x1000926cc 0x180d468b8)
libc++abi.dylib: terminating with uncaught exception of type NSException