搜索

首页  >  问答  >  正文

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}
阿神阿神2773 天前700

全部回复(2)我来回复

  • 巴扎黑

    巴扎黑2017-04-17 16:17:57

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

    回复
    0
  • 伊谢尔伦

    伊谢尔伦2017-04-17 16:17:57

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

    回复
    0
  • 取消回复