简体   繁体   English

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

[英]How to export/get xxx.framework by using Xcode 11.4?

Before Xcode 11.4 I built project and I also could found xxx.framework in the path of xxx/Build/Products/Debug-iphoneos.在 Xcode 11.4 之前,我构建了项目,我还可以在 xxx/Build/Products/Debug-iphoneos 的路径中找到 xxx.framework。

After using Xcode 11.4, I can't found any xxx.framework in that path.使用 Xcode 11.4 后,我在该路径中找不到任何 xxx.framework。

I have seen the link, How to archive/export Framework in Xcode?我已经看到链接, 如何在 Xcode 中存档/导出框架? I follow the step to get the framework but Xcode 11.4 doesn't.我按照步骤获取框架,但 Xcode 11.4 没有。

Does anybody know how to get the framework by using Xcode 11.4?有人知道如何使用 Xcode 11.4 来获取框架吗?

Here's two methods.这里有两种方法。

Method 1 (The method you say is not working for you but most popular):方法1 (你说的方法不适合你,但最流行):

  • Clean your framework ( Not necessary but good practice )清理你的框架(不是必需的,但很好的做法

    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.) Shift + Command + KProduct > Clean Build Folder (有人问:这个Product在哪里。只需将鼠标 hover 放在屏幕顶部,而在 Xcode 中,你会在那里看到它。)

  • Build your framework构建你的框架

    Command + B or Product > Build Command + BProduct > Build

  • Export/Extract/Copy your framework导出/提取/复制您的框架

    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. )在 Xcode 的左侧面板上(您可以在其中看到所有文件夹和 swift 文件),展开名为Products的文件夹(点击文件夹Products旁边的白色小箭头以展开它并查看其内容。

    Once you expanded the Products folder, you should see a very good looking framework staring right at you.展开Products文件夹后,您应该会看到一个非常漂亮的框架正盯着您。 The name should look something like this YourProjectName.framework名称应该类似于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 .现在终于回答您的问题 -如何导出框架...好吧,右键单击框架( YourProjectName.framework ),然后单击Show in Finder

    Once you clicked on Show in Finder , you'll see your YourProjectName.framework folder.单击Show in Finder后,您将看到YourProjectName.framework文件夹。 Yes yes, it looks like a normal folder.是的,它看起来像一个普通的文件夹。 That's because it is.那是因为它是。 Everyone just makes it sound fancy.每个人都只是让它听起来很花哨。

    And there you go.还有你 go。 You can then just drag that fancy-ish YourProjectName.framework folder into you project.然后,您可以将那个花哨的YourProjectName.framework文件夹拖到您的项目中。

Method 2 (Here I'll assume you already read method 1 so I'll explain with less detail):方法2 (这里我假设你已经阅读了方法1,所以我会用更少的细节来解释):

  • Clean your framework (Not necessary but good practice)清理你的框架(不是必需的,但很好的做法)

  • Archive your framework归档你的框架

    Product > Archive (Don't be surprised if you wait a couple of seconds for it to archive.) Product > Archive (如果您等待几秒钟以存档,请不要感到惊讶。)

    Once it's done archiving.一旦完成归档。 You'll see it opens a new Xcode like window.您会看到它打开了一个新的 Xcode,例如 window。 If you don't see this window, it means you were busy with other stuff on your mac at the time it finished.如果您没有看到此 window,则表示您在完成时正忙于 Mac 上的其他内容。 Don't worry haha, just look around on your mac until you find it.别担心哈哈,只要在你的mac上四处看看,直到你找到它。 If you still don't find it, chances are the archiving failed.如果您仍然没有找到它,则很有可能归档失败。 If it failed, Xcode will give you an error log.如果失败,Xcode 会给你一个错误日志。 Read it, fix it, try archiving again.阅读它,修复它,然后再次尝试存档。

    Once it finished archiving and you see the Xcode-like window.完成归档后,您会看到类似 Xcode 的 window。 Your archive will be highlighted.您的存档将突出显示。 It just shows its selected.它只显示它的选择。

  • Export/Extract/Copy your framework导出/提取/复制您的框架

    Right click on the archive and say Show in Finder右键单击存档并说Show in Finder

    The finder will open and have your archive selected.查找器将打开并选择您的存档。

    Right click on that archive and select Show Package Contents右键单击该存档并 select Show Package Contents

    The finder will open your archives contents.查找器将打开您的档案内容。

    Navigate to your framework which is located under Products > Library > Frameworks导航到位于Products > Library > Frameworks下的框架

    There you'll find your YourProjectName.framework folder.在那里你会找到你的YourProjectName.framework文件夹。 select that folder and drag it into your project. select 该文件夹并将其拖到您的项目中。

If none of the above methods worked for you, I guess it opens the opportunity for you to find another way.如果上述方法都不适合您,我想它为您提供了寻找另一种方法的机会。 When you do, come back to this answer and add your method so we all can learn.当您这样做时,请返回此答案并添加您的方法,以便我们所有人都可以学习。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 为 Mac 的 UIKit 构建,但链接框架“XXX.framework”是为 macOS 构建的 - Building for UIKit for Mac, but the linked framework 'XXX.framework' was built for macOS xcode12 issus: ld :building for iOS Simulator,但链接到为 iOS 构建的目标文件,文件 'xxx.framework/xxx' 用于架构 arm64 - xcode12 issus: ld :building for iOS Simulator, but linking in object file built for iOS, file 'xxx.framework/xxx' for architecture arm64 “为 iOS 构建,但嵌入式框架‘xxx.framework’是为 iOS + iOS 模拟器构建的” - “Building for iOS, but the embedded framework 'xxx.framework' was built for iOS + iOS Simulator” 无法在 Xcode 11.4 中导出测试结果 - Unable to export test result in Xcode 11.4 如何在 Xcode 中归档/导出框架? - How to archive/export Framework in Xcode? 如何在 xcode 11.4 中更改模拟器设备? - How to change simulator device in xcode 11.4? 如何在 Xcode 11.4 中将 Swift 3 更改为 4 - How can change Swift 3 to 4 in Xcode 11.4 如何在 macOS Mojave 10.14.6 上运行 Xcode 11.4 - How to run Xcode 11.4 on macOS Mojave 10.14.6 Xcode 11.4 - 终端介绍 - Xcode 11.4 - Introduction of Terminal Xcode 11.4:为 watchOS 构建,但链接框架“MyFramework.framework”正在为 iOS 构建 - Xcode 11.4: Building for watchOS, but the linked framework 'MyFramework.framework' is building for iOS
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM