ios 原因:没有找到合适的图片

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/32730312/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-31 07:47:29  来源:igfitidea点击:

Reason: no suitable image found

iosiphonexcodedyld

提问by Satsuki

dyld: Library not loaded: @rpath/libswiftCore.dylib
  Referenced from: /var/mobile/Containers/Bundle/Application/3FC2DC5C-A908-42C4-8508-1320E01E0D5B/Stylist.app/Stylist
  Reason: no suitable image found.  Did find:
    /private/var/mobile/Containers/Bundle/Application/3FC2DC5C-A908-42C4-8508-1320E01E0D5B/testapp.app/Frameworks/libswiftCore.dylib: mmap() errno=1 validating first page of '/private/var/mobile/Containers/Bundle/Application/3FC2DC5C-A908-42C4-8508-1320E01E0D5B/testapp.app/Frameworks/libswiftCore.dylib'
(lldb) 

I am getting this error when building on my iPhone. I am able to build on the simulator. I have redone all my provision files however I still can't build on my iPhone. My Xcode is like this

在我的 iPhone 上构建时出现此错误。我能够在模拟器上构建。我已经重做了所有的配置文件,但是我仍然无法在我的 iPhone 上构建。我的Xcode是这样的

enter image description here

在此处输入图片说明

Is this a framework problem or a signing issue? This did not happen in Xcode 6. Thank you.

这是框架问题还是签名问题?这在 Xcode 6 中没有发生。谢谢。

回答by Jieyi Hu

I have this problem before for accidentally revoked my certificate. Then all my swift projects have this problem. There are two ways to solve this:

我之前遇到过这个问题,因为我不小心撤销了我的证书。然后我所有的 swift 项目都有这个问题。有两种方法可以解决这个问题:

Click on Product → Clean (or CMD+ Shift+ K)

单击产品 → 清洁(或CMD+ Shift+ K

Or by manually cleaning the Xcode setting files:

或者通过手动清理 Xcode 设置文件:

rm -rf "$(getconf DARWIN_USER_CACHE_DIR)/org.llvm.clang/ModuleCache"
rm -rf ~/Library/Developer/Xcode/DerivedData
rm -rf ~/Library/Caches/com.apple.dt.Xcode

回答by Satsuki

I searched long on this issue. There are several reasons causes this issue.

我在这个问题上搜索了很长时间。导致此问题的原因有多种。

If you are facing when you and Swift code/library in an Objectice C project you should try Solution 1-2-3

如果您在 Objectice C 项目中遇到 Swift 代码/库,您应该尝试解决方案 1-2-3

If you are facing this issue with a new a Swift project Solution 4 will fit you best.

如果您在新的 Swift 项目中遇到此问题,解决方案 4 将最适合您。

Solution 1:

解决方案1

Restart Xcode, then computer and iPhone

重启Xcode,然后电脑和iPhone

Solution 2:

解决方案2

Go to project build settings and set Embedded Content Contains SwiftCode flag to YES

转到项目构建设置并将Embedded Content Contains Swift代码标志设置为 YES

Solution 3:

解决方案3:

Go to project build settings and add @executable_path/Frameworksto Runpath Search Paths option

转到项目构建设置并添加@executable_path/Frameworks到运行路径搜索路径选项

Solution 4:

解决方案4:

If none of above works, this should. Apple seems to be ninja patched certificates as mentioned in AirSign's post

如果以上都不起作用,这应该。Apple 似乎是 AirSign 帖子中提到的 ninja 修补证书

At InHouse certificates

在内部证书

Subject: UID=269J2W3P2L, CN=iPhone Distribution: Company Name, O=Company Name, C=FR

they added a new field named OU

他们添加了一个名为的新字段 OU

Subject: UID=269J2W3P2L, CN=iPhone Distribution: Company Name, OU=269J2W3P2L, O=Company Name, C=FR

so you should just recreate certificate and provision

所以你应该重新创建证书和配置

回答by Sean Vikoren

Xcode->Product->Clean + Xcode Restart

After attempting many of the other mentioned solutions, to my eternal embarrassment, doing an Xcode->Product->Clean and restarting Xcode, did the trick.

在尝试了许多其他提到的解决方案后,让我永远尴尬的是,执行 Xcode->Product->Clean 并重新启动 Xcode,成功了。

回答by Warblr

For me this issue was appearing due to the WWRD cert -- Mine was up to date but for some reason it was set to 'always trust' instead of 'use system default', which apparently makes a difference.

对我来说,这个问题是由于 WWRD 证书而出现的——我的是最新的,但由于某种原因,它被设置为“始终信任”而不是“使用系统默认值”,这显然有所不同。

回答by user1742302

If you accidentally reset your keychain, this can occur due to missing Apple certificates in the keychain. I followed the answer on thisto solve my problem.

如果您不小心重置了您的钥匙串,这可能是由于钥匙串中缺少 Apple 证书而发生的。我跟着就回答这个解决我的问题。

I had the same issue and was able to fix by re-downloading the WWDR (Apple Worldwide Developer Relations Certification Authority). Download from here: http://developer.apple.com/certificationauthority/AppleWWDRCA.cer

我遇到了同样的问题,并且能够通过重新下载 WWDR(Apple 全球开发者关系认证机构)来解决。从这里下载:http: //developer.apple.com/certificationauthority/AppleWWDRCA.cer

回答by NBoymanns

Removing the DerivedData did the trick for me.

删除 DerivedData 对我有用。

Did it through Xcode -> Preferences -> Locations -> clicked the arrow behind the DerivedData path and removed the whole DerivedData folder in the Finder.

通过 Xcode -> Preferences -> Locations -> 单击 DerivedData 路径后面的箭头并删除 Finder 中的整个 DerivedData 文件夹。

回答by Jagveer Singh

It occurred on my side when building an app in the command line via xcodebuild and xcrun PackageApplication, signing the app with an enterprise profile. On our CI build servers, the certificate was set to "Always Trust" in the keychain (select certificate -> Get Info -> Trust -> "Use System Default" can be changed to "Always Trust"). I had to set it back to "Use System Default" in order to make this work. Initially we set this to "Always Trust" to work-around the keychain dialogs that appear after software updates and certificate updates.

当我通过 xcodebuild 和 xcrun PackageApplication 在命令行中构建应用程序时,它发生在我身边,使用企业配置文件对应用程序进行签名。在我们的 CI 构建服务器上,证书在钥匙串中设置为“始终信任”(选择证书 -> 获取信息 -> 信任 ->“使用系统默认值”可以更改为“始终信任”)。我必须将其设置回“使用系统默认值”才能使其正常工作。最初,我们将其设置为“始终信任”以解决软件更新和证书更新后出现的钥匙串对话框。

回答by Maxim Firsoff

  1. Remove the app from device
  2. Clean the project (CMD+ SHift+ K)
  3. Build/Run on device
  1. 从设备中删除应用程序
  2. 清理项目(CMD+ SHift+ K
  3. 在设备上构建/运行

回答by daimler250v8

At the risk of sowing more confusion, I had this issue when updating to XC8.

冒着造成更多混乱的风险,我在更新到 XC8 时遇到了这个问题。

None of these suggestions, nor from any other thread, solved it. What DID work, was removing EVERYTHING from the "Link Binary with Libraries" build phase, the "Target Dependencies" build phase, and the "Linked Frameworks and Libraries" General setting.

这些建议和任何其他线程都没有解决它。所做的工作是从“链接二进制与库”构建阶段、“目标依赖项”构建阶段和“链接框架和库”常规设置中删除所有内容。

FYI, I'm using Carthage and had added $(PROJECT_DIR)/Carthage/Build/tvOSto the FRAMEWORK_SEARCH_PATHSbuild setting, so that my frameworks could be found.

仅供参考,我正在使用 Carthage 并添加$(PROJECT_DIR)/Carthage/Build/tvOSFRAMEWORK_SEARCH_PATHS构建设置中,以便可以找到我的框架。

FYI 2, this projects and the frameworks, are 100% swift and the frameworks are building DEFINES_MODULE = YES.

仅供参考 2,这个项目和框架是 100% 迅速的,并且框架正在构建DEFINES_MODULE = YES

回答by A.G

Cited from Technical Q&A QA1886:

引自技术问答 QA1886

Swift app crashes when trying to reference Swift library libswiftCore.dylib.

尝试引用 Swift 库 libswiftCore.dylib 时,Swift 应用程序崩溃。

Q: What can I do about the libswiftCore.dylib loading error in my device's console that happens when I try to run my Swift language app?

问:当我尝试运行我的 Swift 语言应用程序时,我该如何处理设备控制台中的 libswiftCore.dylib 加载错误?

A: To correct this problem, you will need to sign your app using code signing certificates with the Subject Organizational Unit (OU) set to your Team ID. All Enterprise and standard iOS developer certificates that are created after iOS 8 was released have the new Team ID field in the proper place to allow Swift language apps to run.

答:要解决此问题,您需要使用代码签名证书对您的应用进行签名,并将主题组织单位 (OU) 设置为您的团队 ID。在 iOS 8 发布之后创建的所有企业和标准 iOS 开发人员证书在适当的位置都有新的团队 ID 字段,以允许 Swift 语言应用程序运行。

Usually this error appears in the device's console log with a message similar to one of the following: [....] [deny-mmap] mapped file has no team identifier and is not a platform binary: /private/var/mobile/Containers/Bundle/Application/5D8FB2F7-1083-4564-94B2-0CB7DC75C9D1/YourAppNameHere.app/Frameworks/libswiftCore.dylib

通常此错误出现在设备的控制台日志中,并带有类似于以下内容之一的消息:[....] [deny-mmap] 映射文件没有团队标识符并且不是平台二进制文件:/private/var/mobile/容器/捆绑/应用程序/5D8FB2F7-1083-4564-94B2-0CB7DC75C9D1/YourAppNameHere.app/Frameworks/libswiftCore.dylib

Dyld Error Message:
  Library not loaded: @rpath/libswiftCore.dylib

Exception Type: EXC_BREAKPOINT (SIGTRAP)
Exception Codes: 0x0000000000000001, 0x0000000120021088
Triggered by Thread: 0

Referenced from: /private/var/mobile/Containers/Bundle/Application/C3DCD586-2A40-4C7C-AA2B-64EDAE8339E2/TestApp.app/TestApp
Reason: no suitable image found. Did find:
/private/var/mobile/Containers/Bundle/Application/C3DCD586-2A40-4C7C-AA2B-64EDAE8339E2/TestApp.app/Frameworks/libswiftCore.dylib: mmap() error 1 at address=0x1001D8000, size=0x00194000 segment=__TEXT in Segment::map() mapping /private/var/mobile/Containers/Bundle/Application/C3DCD586-2A40-4C7C-AA2B-64EDAE8339E2/TestApp.app/Frameworks/libswiftCore.dylib
Dyld Version: 353.5

The new certificates are needed when building an archive and packaging your app. Even if you have one of the new certificates, just resigning an existing swift app archive won't work. If it was built with a pre-iOS 8 certificate, you will need to build another archive.

构建存档和打包应用程序时需要新证书。即使您拥有其中一个新证书,仅对现有的 swift 应用程序存档进行签名也是行不通的。如果它是使用 iOS 8 之前的证书构建的,您将需要构建另一个存档。

Important: Please use caution if you need to revoke and setup up a new Enterprise Distribution certificate. If you are an in-house Enterprise developer you will need to be careful that you do not revoke a distribution certificate that was used to sign an app any one of your Enterprise employees is still using as any apps that were signed with that enterprise distribution certificate will stop working immediately. The above only applies to Enterprise Distribution certificates. Development certs are safe to revoke for enterprise/standard iOS developers.

重要提示:如果您需要撤销和设置新的企业分发证书,请谨慎使用。如果您是内部企业开发人员,则需要注意不要撤销用于签署应用程序的分发证书 任何企业员工仍在使用的分发证书与使用该企业分发证书签名的任何应用程序相同将立即停止工作。以上仅适用于企业分发证书。企业/标准 iOS 开发人员可以安全地撤销开发证书。

As the AirSign guys state the problem roots from the missing OU attribute in the subject field of the In-House certificate.

正如 AirSign 人员所说,问题根源于内部证书主题字段中缺少的 OU 属性。

Subject: UID=269J2W3P2L, CN=iPhone Distribution: Company Name, OU=269J2W3P2L, O=Company Name, C=FR

主题:UID=269J2W3P2L,CN=iPhone 分布:公司名称,OU=269J2W3P2L,O=公司名称,C=FR

I have an enterprise development certificate, creating a new one solved the issue.

我有企业开发证书,创建一个新的解决了这个问题。