ios9 加载动态库

问题描述:
ios9 在运行时通过dlopen()方法加载动态库文件(framework),加载失败,在ios8一下版本程序运行正常。
代码如下:

// 加载应用
NSBundle *appBundle = [NSBundle bundleWithPath:appPath];
NSError *error = nil;
            
if ([appBundle loadAndReturnError:&error])
{
    NSLog(@"bundle load framework success.");
}
else
{
    NSLog(@"bundle load framework err:%@",error);
}

失败log:

bundle load framework err:Error Domain=NSCocoaErrorDomain Code=3587 "dlopen_preflight(/var/mobile/Containers/Data/Application/F34F9E7A-C129-46F5-A5C6-C82E843F764C/Documents/xxxx.framework/xxxx): no suitable image found.  Did find:
    /var/mobile/Containers/Data/Application/F34F9E7A-C129-46F5-A5C6-C82E843F764C/Documents/xxxx.framework/xxxx: mmap() errno=1 validating first page of '/var/mobile/Containers/Data/Application/F34F9E7A-C129-46F5-A5C6-C82E843F764C/Documents/xxxx.framework/xxxx'" UserInfo={NSLocalizedRecoverySuggestion=请尝试重新安装软件包。, NSFilePath=/var/mobile/Containers/Data/Application/F34F9E7A-C129-46F5-A5C6-C82E843F764C/Documents/xxxx.framework/xxxx, NSLocalizedFailureReason=软件包已损坏或丢失必要的资源。, NSLocalizedDescription=未能载入软件包“xxxx”,因为它已损坏或丢失必要的资源。, NSDebugDescription=dlopen_preflight(/var/mobile/Containers/Data/Application/F34F9E7A-C129-46F5-A5C6-C82E843F764C/Documents/xxxx.framework/xxxx): no suitable image found.  Did find:
    /var/mobile/Containers/Data/Application/F34F9E7A-C129-46F5-A5C6-C82E843F764C/Documents/xxxx.framework/xxxx: mmap() errno=1 validating first page of '/var/mobile/Containers/Data/Application/F34F9E7A-C129-46F5-A5C6-C82E843F764C/Documents/xxxx.framework/xxxx', NSBundlePath=/var/mobile/Containers/Data/Application/F34F9E7A-C129-46F5-A5C6-C82E843F764C/Documents/xxxx.framework}
阅读 5.6k
2 个回答

问题解决了,需要重新申请证书。

新手上路,请多包涵

你好,这个问题,怎么解决的?证书问题,是什么意思?

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题