<legend id='mUk4K'><style id='mUk4K'><dir id='mUk4K'><q id='mUk4K'></q></dir></style></legend>
      • <bdo id='mUk4K'></bdo><ul id='mUk4K'></ul>

      1. <tfoot id='mUk4K'></tfoot>
        <i id='mUk4K'><tr id='mUk4K'><dt id='mUk4K'><q id='mUk4K'><span id='mUk4K'><b id='mUk4K'><form id='mUk4K'><ins id='mUk4K'></ins><ul id='mUk4K'></ul><sub id='mUk4K'></sub></form><legend id='mUk4K'></legend><bdo id='mUk4K'><pre id='mUk4K'><center id='mUk4K'></center></pre></bdo></b><th id='mUk4K'></th></span></q></dt></tr></i><div id='mUk4K'><tfoot id='mUk4K'></tfoot><dl id='mUk4K'><fieldset id='mUk4K'></fieldset></dl></div>

        <small id='mUk4K'></small><noframes id='mUk4K'>

      2. 在 iOS 框架中嵌入 .dylib

        时间:2023-05-18
        <legend id='nXVKk'><style id='nXVKk'><dir id='nXVKk'><q id='nXVKk'></q></dir></style></legend>

            <bdo id='nXVKk'></bdo><ul id='nXVKk'></ul>

          • <small id='nXVKk'></small><noframes id='nXVKk'>

              <tbody id='nXVKk'></tbody>
            <i id='nXVKk'><tr id='nXVKk'><dt id='nXVKk'><q id='nXVKk'><span id='nXVKk'><b id='nXVKk'><form id='nXVKk'><ins id='nXVKk'></ins><ul id='nXVKk'></ul><sub id='nXVKk'></sub></form><legend id='nXVKk'></legend><bdo id='nXVKk'><pre id='nXVKk'><center id='nXVKk'></center></pre></bdo></b><th id='nXVKk'></th></span></q></dt></tr></i><div id='nXVKk'><tfoot id='nXVKk'></tfoot><dl id='nXVKk'><fieldset id='nXVKk'></fieldset></dl></div>
          • <tfoot id='nXVKk'></tfoot>

                  本文介绍了在 iOS 框架中嵌入 .dylib的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  限时送ChatGPT账号..

                  我一直在尝试提交一个带有 Obj-C 动态库 (.dylib) 的 Swift 应用程序,该应用程序不断被 iOS App Store 拒绝并显示诸如

                  I've been trying to submit a Swift app with an Obj-C Dynamic Library (.dylib) which keeps getting rejected by the iOS App Store with error messages such as

                  无效的 Swift 支持 - 文件 libswiftDarwin.dylib,libswiftDispatch.dylib、libswiftCoreGraphics.dylib、libswiftUIKit.dylib、libswiftCore.dylib、libswiftFoundation.dylib、libswiftQuartzCore.dylib, libswiftObjectiveC.dylib,libswiftCoreImage.dylib 不在预期位置/有效载荷//框架.将文件移动到预期的位置位置,使用当前的公共(GM)版本重建您的应用程序Xcode,然后重新提交

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

                  来自 https://developer.apple.com/library/archive/technotes/tn2435/_index.html#//apple_ref/doc/uid/DTS40017543-CH1-PROJ_CONFIG-APPS_WITH_DEPENDENCIES_BETWEEN_FRAMEWORKS 错误"可能表明您的应用正在嵌入一个未打包为框架的动态库.框架包之外的动态库(通常具有文件扩展名 .dylib)在 iOS、watchOS 或 tvOS 上不受支持,除了对于 Xcode 提供的系统 Swift 库."

                  因此,下一步是将动态库(作为子项目)嵌入到 Cocoa Touch 框架项目中.设置完成后,尽管框架构建良好,但我在导入的 dylib 类中遇到了找不到符号"错误.

                  So the next step was to embed the Dynamic Library (as a subproject) within a Cocoa Touch Framework project. Once that was set up, although the framework built fine, I got stuck on "symbol not found" errors for the imported dylib classes.

                  我想知道实现这个项目结构所需的步骤,或者在 iOS 上是否可行.

                  I would like to know the steps required to achieve this project structure, or if its even possible on iOS.

                  推荐答案

                  我能够通过首先创建一个框架来提交一个带有 .dylib 的应用程序.我首先尝试了苹果文档中描述的方法,但是在提交到商店时出现错误(无效的捆绑.xyz.framework 的捆绑包含不允许的文件'框架')

                  I was able to submit an app with a .dylib by creating a framework first. I first tried the method described in the apple documentation, but got errors when submitting to the store ( "invalid bundle. the bundle at xyz.framework contains disallowed file 'Frameworks' )

                  我所做的是使用 lipo 手动将我的 .dylib 打包到框架中.

                  What i did was use lipo to manually package my .dylib into a framework.

                  $ lipo -create mylib.dylib -output mylib
                  

                  现在你得到一个名为mylib"的二进制文件创建一个名为 mylib.framework 的文件夹并将二进制文件放入其中.然后添加一个 Info.plist(您可以从现有框架中复制和修改一个.)在 Info.plist 中,为您的框架填写字段.要更新或添加的主要是可执行文件".这应该是该二进制文件的名称.

                  Now you get a binary file called 'mylib' Create a folder called mylib.framework and put the binary file in it. Then add an Info.plist ( you can just copy and modify one from an existing framework. ) In the Info.plist, fill out the fields for your framework. The main one to update or add is "Executable" which should be the name of that binary file.

                  我遇到了另一个问题,我使用的另一个框架引用了我原来的 .dylib,它已经消失了,现在在框架中.为了解决这个问题,我使用了install_name_tool".修改其他框架以查找我的新框架.

                  I had another issue where another framework I was using was referencing my original .dylib, which is gone and now inside the framework. To fix this I used the "install_name_tool" to modify the other framework to look for my new framework.

                  $ cd OtherLib.framework 
                  $ install_name_tool -change @rpath/mylib.dylib @rpath/mylib.framework/mylib OtherLib
                  

                  您可以在这篇精彩的博文中了解有关该工具的更多信息:https://medium.com/@donblas/fun-with-rpath-otool-and-install-name-tool-e3e41ae86172

                  You can read more about that tool in this good blog post: https://medium.com/@donblas/fun-with-rpath-otool-and-install-name-tool-e3e41ae86172

                  这篇关于在 iOS 框架中嵌入 .dylib的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:架构 i386 的未定义符号,为 iOS 构建? 下一篇:从 iOS 中的 Twitter 框架获取 Twitter 句柄

                  相关文章

                  1. <legend id='AIKc9'><style id='AIKc9'><dir id='AIKc9'><q id='AIKc9'></q></dir></style></legend>

                  2. <i id='AIKc9'><tr id='AIKc9'><dt id='AIKc9'><q id='AIKc9'><span id='AIKc9'><b id='AIKc9'><form id='AIKc9'><ins id='AIKc9'></ins><ul id='AIKc9'></ul><sub id='AIKc9'></sub></form><legend id='AIKc9'></legend><bdo id='AIKc9'><pre id='AIKc9'><center id='AIKc9'></center></pre></bdo></b><th id='AIKc9'></th></span></q></dt></tr></i><div id='AIKc9'><tfoot id='AIKc9'></tfoot><dl id='AIKc9'><fieldset id='AIKc9'></fieldset></dl></div>
                    <tfoot id='AIKc9'></tfoot>

                    <small id='AIKc9'></small><noframes id='AIKc9'>

                    • <bdo id='AIKc9'></bdo><ul id='AIKc9'></ul>