Fetching XCFramework dependencies

Greetings,


I have a project that references several XCFrameworks that I don't want to store in my repo along with the project due to their size.

So I've set it up with a local copy and make it compile without errors.

And now I'm trying to remove the local copies of the frameworks and fetch them from a remote server at the build time.

But I'm getting errors that frameworks are not available.

This approach worked previously with the regular frameworks


Does anyone know if it's possible to fetch XCFramework dependencies as a dependency target/build phase in the Xcode project?

Accepted Reply

It would be safer to run this as a pre-build script so the files are copied locally before the build begins to reduce any problems with network connectivity fluctuating mid-build or a race between targets in a parallel build. You can automate this in Xcode by using a feature of the scheme called a build pre-action. When you go to edit your scheme, open the disclosure triangle on the Build action, and you'll see 3 options, Pre-actions, Build, and Post-actions. You can add a shell script to the pre-action that does the copy.

Replies

Are you copying them from the remote server to your local machine during the build, or are you trying to reference them via a remote file path, such as a SMB mount point?

I'm trying to copy them over during the build in the build phase. The frameworks are referenced by the local paths in the project

It would be safer to run this as a pre-build script so the files are copied locally before the build begins to reduce any problems with network connectivity fluctuating mid-build or a race between targets in a parallel build. You can automate this in Xcode by using a feature of the scheme called a build pre-action. When you go to edit your scheme, open the disclosure triangle on the Build action, and you'll see 3 options, Pre-actions, Build, and Post-actions. You can add a shell script to the pre-action that does the copy.

Thanks edford.


That's what I eventually did.