Skip to content

Failed to add binary version of framework in Xcode 13 #536

@ton252

Description

@ton252

In our team we have no opportunity to import swift-snapshot-testing using GitHub.
And we decided to build a binary version of xcframework and put it inside project. But when we upgraded Xcode to 13 version it stoped working.

We set property Build for distribution = YES in project. Here is a script, that we use to build xcframework:

xcodebuild archive \
 -scheme SnapshotTesting_iOS \
 -archivePath "./build/ios.xcarchive" \
 -sdk iphoneos \
 BUILD_LIBRARY_FOR_DISTRIBUTION=YES \
 SKIP_INSTALL=NO

# iOS simulator

xcodebuild archive \
 -scheme SnapshotTesting_iOS \
 -archivePath "./build/ios_sim.xcarchive" \
 -sdk iphonesimulator \
 BUILD_LIBRARY_FOR_DISTRIBUTION=YES \
 SKIP_INSTALL=NO

 # macOS

xcodebuild archive \
 -scheme SnapshotTesting_macOS \
 -archivePath "./build/macos.xcarchive" \
 BUILD_LIBRARY_FOR_DISTRIBUTION=YES \
 SKIP_INSTALL=NO

 # tvOS

 xcodebuild archive \
 -scheme SnapshotTesting_tvOS \
 -archivePath "./build/tvos.xcarchive" \
 BUILD_LIBRARY_FOR_DISTRIBUTION=YES \
 SKIP_INSTALL=NO

Pack to xcframework

 xcodebuild -create-xcframework \
  -framework "./build/ios.xcarchive/Products/Library/Frameworks/SnapshotTesting.framework" \
  -framework "./build/ios_sim.xcarchive/Products/Library/Frameworks/SnapshotTesting.framework" \
  -framework "./build/macos.xcarchive/Products/Library/Frameworks/SnapshotTesting.framework" \
  -output "./build/SnapshotTesting.xcframework"

and this is an error message:

Failed to build module 'SnapshotTesting'; this SDK is not supported by the compiler (the SDK is built with 'Apple Swift 
version 5.4.2 (swiftlang-1205.0.28.2 clang-1205.0.19.57)', while this compiler is 'Apple Swift version 5.5.1 (swiftlang-
1300.0.31.4 clang-1300.0.29.6)'). Please select a toolchain which matches the SDK.
'XCTAttachment' is not a member type of class 'XCTest.XCTest'
'XCTestCase' is not a member type of class 'XCTest.XCTest'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions