Rahul Chhetri
Rahul Chhetri

Reputation: 171

using xcframework within a framework

Can I use a .xcframework inside a .framework?

When I try this the framework target builds fine, but when I use this framework in an iOS app target, it gives build error

For eg:

MyApp is iOS app target
MyFramework is a framework (embedded in MyApp)
MyXcFramework is a xcframework (embedded in MyFramework)

A sample swift file inside MyFramework contains

import Foundation
import MyXcFramework

and builds successfully

But when MyFramework is added to MyAapp i get the following error

import Foundation
import MyXcFramework <- No such module MyXcFramework

Can anyone help what I am doing wrong?

Upvotes: 3

Views: 1604

Answers (2)

AsifHabib
AsifHabib

Reputation: 950

According to the documentation, it is not allowed in iOS. Apps with Dependencies Between Frameworks

An umbrella framework is a framework bundle that contains other frameworks. While it is possible to create umbrella frameworks for macOS apps, doing so is unnecessary for most developers and is not recommended. Umbrella frameworks are not supported on iOS, watchOS, or tvOS.

I had a framework, that had subframework, everything compiled sucessfuly, I shared the app with Diawi link. QA approved the build. When I tried to upload the build I had following error. TestFlight upload error

Upvotes: 0

Soumya Mahunt
Soumya Mahunt

Reputation: 2802

It seems like you are trying to use the xcframework without adding it to the app. If you want to use your xcframework in your app too you have to add that xcframework in your app target, you can avoid embedding xcframework in the framework and only embed for the app itself.

Upvotes: 1

Related Questions