首页 > 解决方案 > 将dylib嵌入iOS应用程序的正确方法

问题描述

我有一个项目,它包含三个元素: 编译为 .dylib 的 C 源代码 Swift 框架用于为 .dylib 使用 .dylib 和 swift 代理的 iOS 应用程序提供用户友好的 swift API

我已将 swift proxy 和 .dylib 作为“框架和库”依赖项添加到 iOS 应用程序项目中。在我的 iPhone 上一切正常。但是,当我尝试将我的应用程序发送到 Apple Store Connect 时,我收到以下错误:

ITMS-90429: Invalid Swift Support - The files libswiftDarwin.dylib, libswiftDispatch.dylib, libswiftCoreGraphics.dylib, libswiftCoreFoundation.dylib, libswiftCore.dylib, libswiftFoundation.dylib, libswiftObjectiveC.dylib aren’t at the expected location /Payload/Runner.app/Frameworks. Move the file to the expected location, rebuild your app using the current public (GM) version of Xcode, and resubmit it.

我认为这可能是由于 .dylib 文件直接嵌入到 iOS 应用程序中造成的,所以我尝试将 .dylib 嵌入到 swift 框架中。然后我让 iOS 应用程序只嵌入了 swift 框架,它由 .dylib 文件组成。但是,我在此配置中收到以下错误:

dyld: Library not loaded: @rpath/libX.dylib
  Referenced from: /private/var/containers/Bundle/Application/.../swiftProxy.framework/swiftProxy
  Reason: no suitable image found.  Did find:
  /private/var/containers/Bundle/Application/.../swiftProxy.framework/Frameworks/libX.dylib: code signature in (/private/var/containers/Bundle/Application/.../swiftProxy.framework/Frameworks/libX.dylib) not valid for use in process using Library Validation: mapped file has no cdhash, completely unsigned? Code has to be at least ad-hoc signed.

这对我来说没有意义,但我认为这不是正确的方法。

所以问题是:我如何正确嵌入 dylib 以便它可以放在 Apple Store Connect 上,然后放在 Testflight 上?

我知道这个问题至少被问过一次,但没有一个像样的答案。例如:如何在 iOS 应用项目中正确嵌入第 3 方 .dylib 文件以供 App Store 发布?

谢谢

标签: iosswiftxcodeapp-store-connectdylib

解决方案


推荐阅读