Building an xcframework with MacOS and Mac Catalyst support

Using xcodebuild, I have built (and archived) several variations of a framework with the following destinations:

'generic/platform=iOS',
'generic/platform=iOS Simulator',
'generic/platform=macOS',
'generic/platform=macOS,variant=Mac Catalyst'

I now wish to combine the frameworks into an xcframework using the -create-xcframework switch to xcodebuild. As arguments I am passing an instance of each Archive and the framework to xcodebuild. For example:

xcodebuild -archive mycode_ios.xcarchive -framework mycode.framework -archive mycode_ios_simulator.xcarchive -framework mycode.framework [... others here ...] -output mycode.xframework

With the destinations above I get an error message:

A library with the identifier 'macos-arm64_x86_64' already exists.

I assume that the macOS framework and the Mac Catalyst framework are conflicting with one another as they share the same platform and architectures. For that matter I guess the iOS simulator may also be considered macOS with those architectures.

How are the "library identifiers" generated and is there a way I can ensure the Mac Catalyst, MacOS, and iOS simulator identifiers are distinct?

Perhaps I do not need to? Then what is the minimum set of frameworks I would need to support MacOS, Mac Catalyst, iOS (device) and iOS Simulator in one xcframework?

Answered by sthompson-crestron in 765260022

Nevermind. Apparently I had one of my destinations wrong somehow and missed the notification that the destination was not recognized.

After vigorously quadruple checking the destinations, cleaning my build folders, and building things again, the xcframework builds as expected without an error message.

I suspect I had a typo in one of my destinations that was causing xcodebuild to select my local Mac as the destination and I missed the error message in output telling me I had a problem.

Accepted Answer

Nevermind. Apparently I had one of my destinations wrong somehow and missed the notification that the destination was not recognized.

After vigorously quadruple checking the destinations, cleaning my build folders, and building things again, the xcframework builds as expected without an error message.

I suspect I had a typo in one of my destinations that was causing xcodebuild to select my local Mac as the destination and I missed the error message in output telling me I had a problem.

Building an xcframework with MacOS and Mac Catalyst support
 
 
Q