"A library with the identifier 'ios-arm64' already exists" when creating XCFramework with XCode 14

Creating an xcframework with XCode 13.4.1 and the following code snippet works just fine. The problem is that from XCode 14 - we get this error:

A library with the identifier 'ios-arm64' already exists.

Supported Platforms: iOS

Architectures: Standard Architectures (arm64)

CPU: Intel

# Archiving for iOS Device
xcodebuild clean archive \
-scheme "${SCHEME_NAME}" \
-configuration "${CONFIGURATION}" \
-sdk iphoneos \
-archivePath "${IOS_DEVICE_ARCHIVE_PATH}" \
-destination generic/platform=iOS \
SKIP_INSTALL=NO \
BUILD_LIBRARY_FOR_DISTRIBUTION=YES

# Archiving for iOS Simulator
xcodebuild archive \
-scheme "${SCHEME_NAME}" \
-configuration "${CONFIGURATION}" \
-sdk iphonesimulator \
-archivePath "${IOS_SIMULATOR_ARCHIVE_PATH}" \
-destination generic/platform=iOS \
SKIP_INSTALL=NO \
BUILD_LIBRARY_FOR_DISTRIBUTION=YES

# Creating XCFramework
xcodebuild -create-xcframework \
-framework "${IOS_DEVICE_ARCHIVE_PATH}/Products/Library/Frameworks/${FRAMEWORK_NAME}.framework" \
-framework "${IOS_SIMULATOR_ARCHIVE_PATH}/Products/Library/Frameworks/${FRAMEWORK_NAME}.framework" \
-output "${XC_FRAMEWORK_PATH}"

I think this was the right way to create an XCFramework prior XCode 14. Not sure if some build settings can affect it, but any help is welcomed.

Thanks

Issue is resolved.

It turned out that simulator archive destination was the problem:

`-destination generic/platform=iOS

instead of

-destination generic/platform=“iOS Simulator” 

Also looks like the -sdk iphoneos and -sdk iphonesimulator are not needed when specify the -destination

"A library with the identifier 'ios-arm64' already exists" when creating XCFramework with XCode 14
 
 
Q