ios - 如何使用 Xcode 11.4 导出/获取 xxx.framework?

标签 ios frameworks xcode11.4

在 Xcode 11.4 之前我构建了项目,我也可以在 xxx/Build/Products/Debug-iphoneos 的路径中找到 xxx.framework。

使用 Xcode 11.4 后,我在该路径中找不到任何 xxx.framework。

我看过链接,How to archive/export Framework in Xcode?我按照步骤获取框架,但 Xcode 11.4 没有。

有人知道如何使用 Xcode 11.4 获取框架吗?

最佳答案

这里有两种方法。
方法一 (你说的方法不适合你,但最流行):

  • 清理你的框架(不是必需的,但很好的做法)

    Shift + Command + K or Product > Clean Build Folder (Some ask: where is this Product. Just hover your mouse at the top of the screen whilst in Xcode, you'll see it there.)


  • 构建你的框架

    Command + B or Product > Build


  • 导出/提取/复制您的框架

    On the left panel of Xcode (Where you see all your folders and swift files), expand the folder that's named Products (tap on the little white arrow next to the folder Products to expand it and see its contents.)


    Once you expanded the Products folder, you should see a very good looking framework staring right at you. The name should look something like this YourProjectName.framework


    Now to finally answer your question - HOW TO EXPORT THE FRAMEWORK...well right click on the framework (the YourProjectName.framework) and click on Show in Finder.


    Once you clicked on Show in Finder, you'll see your YourProjectName.framework folder. Yes yes, it looks like a normal folder. That's because it is. Everyone just makes it sound fancy.


    And there you go. You can then just drag that fancy-ish YourProjectName.framework folder into you project.



  • 方法二 (这里我假设你已经阅读了方法 1,所以我会用更少的细节来解释):
  • 清理你的框架(不是必需的,但很好的做法)
  • 归档你的框架

    Product > Archive (Don't be surprised if you wait a couple of seconds for it to archive.)


    Once it's done archiving. You'll see it opens a new Xcode like window. If you don't see this window, it means you were busy with other stuff on your mac at the time it finished. Don't worry haha, just look around on your mac until you find it. If you still don't find it, chances are the archiving failed. If it failed, Xcode will give you an error log. Read it, fix it, try archiving again.


    Once it finished archiving and you see the Xcode-like window. Your archive will be highlighted. It just shows its selected.


  • 导出/提取/复制您的框架

    Right click on the archive and say Show in Finder


    The finder will open and have your archive selected.


    Right click on that archive and select Show Package Contents


    The finder will open your archives contents.


    Navigate to your framework which is located under Products > Library > Frameworks


    There you'll find your YourProjectName.framework folder. select that folder and drag it into your project.



  • 如果上述方法都不适合您,我想它为您提供了寻找另一种方法的机会。当您这样做时,请返回此答案并添加您的方法,以便我们所有人都可以学习。

    关于ios - 如何使用 Xcode 11.4 导出/获取 xxx.framework?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61172182/

    相关文章:

    ios - 在 GameViewController 中的 SKScene 后面显示 UIView

    frameworks - 机器学习人工智能框架的设计

    ios - 为不兼容的目标 x86_64-apple-ios13.0 创建了模块 'Swift'

    c# - 如何处理 .NET 下未记录的 API/框架?

    xcode - 在模拟器中测试丰富的通知

    ios - 将数据从 Sqlite 移动到 Swift 中的核心数据

    ios - Swift:在委托(delegate)方法中使用 presentViewController 时为 "Attempt to present ViewController whose view is not in the window hierarchy"

    macos - Mac 命令行工具 11.4 不再有 svn

    ios - 无法在 Xcode 11.4 中导出测试结果

    iphone - 添加 bool 值的观察者