How to archive/export Framework in Xcode?
Asked Answered
B

4

35

I have a project with a framework target, but when I archive, the framework does not show up in organizer. I checked apple for documentation, but only found reference for static libraries.

Has anyone experienced this before?

Here are screenshots of my current scheme settings Build Scheme Release Scheme

Beguine answered 14/12, 2015 at 16:24 Comment(0)
U
23

Go into your framework and build.

cmd+b

You will find in your products YOUR_FRAMEWORK.framework

enter image description here

Right click on "YourLibrary.framework" -> Show in Finder

enter image description here

Now you can share/import your library.

Attention: Don't link/reference to this path because the framework is stored in Derived Data.

Unshakable answered 9/2, 2018 at 13:52 Comment(2)
This build is not through archiving. Something only effective on archiving (e.g ENABLE_BITCODE) will not take effect. How do we handle this?Salinger
Furthermore, this answer will by default produce a debug build created only for the system's current architecture, rather than a universal binary release.Saddle
Z
4

The steps are documented by Apple here

Set up the project

To set up your project for creating an XCFramework, ensure your Xcode project has a scheme that builds only the framework target and its dependencies.

Configure these build settings on your target:

Set the Build Libraries for Distribution build setting to Yes. For Swift, this enables support for library evolution and generation of a module interface file.

Set the Skip Install build setting to No. If enabled, the built products aren‘t included in the archives.

Leave the Architectures build setting unset. The predefined value configures the target to build a universal binary for all the possible architectures the target platform uses.

Then you can use Archive to build your framework for Release.

Once built, the Organizer window will open. You can then click on Distribute Content -> Build Products and export your framework.

Zurheide answered 14/12, 2022 at 4:8 Comment(2)
This ought to be marked as the correct answer.Saddle
Yes the approved answer is convenient , but this is the correct answer right here. Especially if setting up CI/CD , do it right.Monkish
H
0

The only thing you should do is build the target,then show Products in finder ,you will see it.

Horsehide answered 23/11, 2016 at 13:2 Comment(0)
H
0

Archive framework

Product -> Archive
//or
xcodebuild archive

[Archive location]

Xcode v12 does not have such problem and when you try to archive a framework Xcode prompt you to corresponding Archives window

Archive is an action from Scheme[About] which is competitor for Build action. Archive includes Build with additional logic. For example Archive is used for XCFramework[Example] which additionally can contains .dSYM and .BCSymbolMap files

For usual purposes you can just use Build action, it creates a corresponding .framework file in a Build location[About]

Hoboken answered 8/5, 2021 at 13:29 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.