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

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

        <bdo id='RTW22'></bdo><ul id='RTW22'></ul>
      <legend id='RTW22'><style id='RTW22'><dir id='RTW22'><q id='RTW22'></q></dir></style></legend>
    1. 如何导出“脂肪"?Cocoa Touch 框架(用于模拟器和设备)?

      时间:2023-05-19

        <bdo id='AwH9w'></bdo><ul id='AwH9w'></ul>
            <tbody id='AwH9w'></tbody>
          • <small id='AwH9w'></small><noframes id='AwH9w'>

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

              <tfoot id='AwH9w'></tfoot>

                <legend id='AwH9w'><style id='AwH9w'><dir id='AwH9w'><q id='AwH9w'></q></dir></style></legend>

                本文介绍了如何导出“脂肪"?Cocoa Touch 框架(用于模拟器和设备)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                问题描述

                限时送ChatGPT账号..

                使用 Xcode 6,我们可以创建自己的动态 Cocoa 框架.

                因为:

                • 模拟器仍然使用32位

                • <块引用>

                  从 2015 年 6 月 1 日开始,提交到 App Store 的应用更新必须包含 64 位支持并使用 iOS 8 SDK (,但不是重复的.


                  更新:

                  我发现了一个肮脏的黑客";对于这种情况.请参阅我的答案.如果有人知道更方便的方法 - 请告诉我!

                  解决方案

                  这个答案的实际情况是:2015 年 7 月.很可能情况会发生变化.

                  TLDR;

                  目前 Xcode 没有自动导出通用 fat 框架的工具,因此开发人员必须求助于手动使用 lipo 工具.另外根据这个雷达在提交给作为框架消费者的AppStore开发者之前也必须使用lipo 从框架中剥离模拟器切片.

                  下面是更长的答案

                  <小时>

                  我在该主题上做了类似的研究(答案底部的链接).

                  我没有找到任何关于分发的官方文档,所以我的研究是基于对 Apple 开发者论坛、Carthage 和 Realm 项目的探索以及我自己对 xcodebuildlipo代码设计工具.

                  这是来自 Apple 开发者论坛线程 Exporting app with嵌入式框架:

                  <块引用>

                  从框架项目中导出框架的正确方法是什么?

                  目前唯一的方法就是你所做的:

                  • 为模拟器和 iOS 设备构建目标.
                  • 导航到该项目的 Xcode 的 DerivedData 文件夹,然后将两个二进制文件合并到一个框架中.但是,当您在 Xcode 中构建框架目标时,请确保将目标设置仅构建活动架构"调整为否".这将允许 Xcode 为多种二进制类型(arm64、armv7 等)构建目标.这就是为什么它可以在 Xcode 中工作,但不能作为独立的二进制文件.

                  • 此外,您还需要确保将方案设置为发布版本,并针对发布版本构建框架目标.如果您仍然收到库未加载错误,请检查框架中的代码片段.

                  • 使用 lipo -info MyFramworkBinary 并检查结果.

                  lipo -info MyFrameworkBinary

                  结果是 i386 x86_64 armv7 arm64

                  • 现代通用框架将包含 4 个切片,但可能包含更多:i386 x86_64 armv7 arm64如果您至少没有看到这 4 个,可能是因为 Build Active Architecture 设置.

                  这描述的过程与@skywinder 在他的回答中所做的几乎相同.

                  这就是 Carthage 使用 lipo 的方式和 Realm 使用 lipo.

                  <小时>

                  重要细节

                  有雷达:Xcode 6.1.1 &6.2:包含模拟器切片的 iOS 框架无法提交到 App Store 并且在 Realm#1163 和 Carthage#188 结束在特殊解决方法中:

                  在提交到 AppStore iOS 框架二进制文件之前,必须从模拟器切片中剥离出来

                  Carthage 有特殊代码:CopyFrameworks 和对应的一份文件:

                  <块引用>

                  此脚本可以解决由通用二进制文件触发的App Store 提交错误.p>

                  Realm 有特殊的脚本:strip-frameworks.sh 和相应的文档:

                  <块引用>

                  此步骤是解决归档通用二进制文件时App Store 提交错误所必需的.

                  还有一篇好文章:从 Xcode 中的动态库中剥离不需要的架构.

                  我自己使用了 Realm 的 strip-frameworks.sh,它完全适合我,无需任何修改,当然任何人都可以自由地从头开始编写.

                  <小时>

                  我推荐阅读我的主题的链接,因为它包含这个问题的另一个方面:代码签名 - 创建 iOS/OSX 框架:是否有必要在分发给其他开发人员之前对其进行代码设计?

                  With Xcode 6 we get ability to create own Dynamic Cocoa Frameworks.

                  Because of:

                  • Simulator still use 32-bit library

                  • beginning June 1, 2015 app updates submitted to the App Store must include 64-bit support and be built with the iOS 8 SDK (developer.apple.com)

                  We have to make fat library to run project on devices and simulators. i.e. support both 32 and 64 bit in Frameworks.

                  But I didn't find any manuals, how to export universal fat Framework for future integration with other projects (and share this library with someone).

                  Here is my steps to reproduce:

                  1. Set ONLY_ACTIVE_ARCH=NO in the Build Settings

                  2. Add support armv7 armv7s arm64 i386 x86_64 to Architectures (for sure)

                  1. Build Framework and open it in Finder:

                  1. Add this framework to another project

                  Actual result:

                  But in the end I still have problem with running project with this framework on devices and simulator at once.

                  • if I take framework from Debug-iphoneos folder - it works on devices and gets error on simulators: ld: symbol(s) not found for architecture i386

                      xcrun lipo -info CoreActionSheetPicker
                    

                    Architectures in the fat file: CoreActionSheetPicker are: armv7 armv7s arm64

                  • if I take framework from Debug-iphonesimulator folder - it works on simulators. and I have error on device: ld: symbol(s) not found for architecture arm64

                      xcrun lipo -info CoreActionSheetPicker
                    

                    Architectures in the fat file: CoreActionSheetPicker are: i386 x86_64

                  So, how to create a dynamic framework that works on devices and simulators?

                  This answer related to Xcode 6 iOS Creating a Cocoa Touch Framework - Architectures issues but it's not duplicate.


                  Update:

                  I found a "dirty hack" for this case. See my answer below. If someone knows more convenient way - please, let me know!

                  解决方案

                  The actuality of this answer is: July 2015. It is most likely that things will change.

                  TLDR;

                  Currently Xcode does not have tools for automatic export of universal fat framework so developer must resort to manual usage of lipo tool. Also according to this radar before submission to AppStore developer who is framework's consumer also must use lipo to strip off simulator slices from a framework.

                  Longer answer follows


                  I did similar research in the topic (the link at the bottom of the answer).

                  I had not found any official documentation about distribution of so my research was based on exploration of Apple Developer Forums, Carthage and Realm projects and my own experiments with xcodebuild, lipo, codesign tools.

                  Here's long quote (with a bit of markup from me) from Apple Developer Forums thread Exporting app with embedded framework:

                  What is the proper way to export a framework from a framework project?

                  Currently the only way is exactly what you have done:

                  • Build the target for both simulator and iOS device.
                  • Navigate to Xcode's DerivedData folder for that project and lipo the two binaries together into one single framework. However, when you build the framework target in Xcode, make sure to adjust the target setting 'Build Active Architecture Only' to 'NO'. This will allow Xcode to build the target for multiple binarty types (arm64, armv7, etc). This would be why it works from Xcode but not as a standalone binary.

                  • Also you'll want to make sure the scheme is set to a Release build and build the framework target against release. If you are still getting a library not loaded error, check the code slices in the framework.

                  • Use lipo -info MyFramworkBinary and examine the result.

                  lipo -info MyFrameworkBinary

                  Result is i386 x86_64 armv7 arm64

                  • Modern universal frameworks will include 4 slices, but could include more: i386 x86_64 armv7 arm64 If you don't see at least this 4 it coud be because of the Build Active Architecture setting.

                  This describes process pretty much the same as @skywinder did it in his answer.

                  This is how Carthage uses lipo and Realm uses lipo.


                  IMPORTANT DETAIL

                  There is radar: Xcode 6.1.1 & 6.2: iOS frameworks containing simulator slices can't be submitted to the App Store and a long discussion around it on Realm#1163 and Carthage#188 which ended in special workaround:

                  before submission to AppStore iOS framework binaries must be stripped off back from simulator slices

                  Carthage has special code: CopyFrameworks and corresponding piece of documentation:

                  This script works around an App Store submission bug triggered by universal binaries.

                  Realm has special script: strip-frameworks.sh and corresponding piece of documentation:

                  This step is required to work around an App Store submission bug when archiving universal binaries.

                  Also there is good article: Stripping Unwanted Architectures From Dynamic Libraries In Xcode.

                  I myself used Realm's strip-frameworks.sh which worked for me perfectly without any modifications though of course anyone is free to write a one from scratch.


                  The link to my topic which I recommend to read because it contains another aspect of this question: code signing - Creating iOS/OSX Frameworks: is it necessary to codesign them before distributing to other developers?

                  这篇关于如何导出“脂肪"?Cocoa Touch 框架(用于模拟器和设备)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                上一篇:如何以安全的方式为其他开发人员构建框架或库? 下一篇:为什么我们使用 use_frameworks!在 CocoaPods 中?

                相关文章

              • <legend id='ofI5m'><style id='ofI5m'><dir id='ofI5m'><q id='ofI5m'></q></dir></style></legend>
                <tfoot id='ofI5m'></tfoot>

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

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