I am upgrading my project's old framework dependencies to be xcframework files so that I can run on the simulator on my M1 Mac. I'm using Xcode 13.3.1 and the new build system.
When I build my project with a target of a Simulator, I get this build error:
ld: in ../CommonKit/External/AppCenter/AppCenter.xcframework/ios-arm64_arm64e_armv7_armv7s/AppCenter.framework/AppCenter(MSACAppCenter.o),
building for iOS Simulator, but linking in object file built for iOS, file
'../CommonKit/External/AppCenter/AppCenter.xcframework/ios-arm64_arm64e_armv7_armv7s/AppCenter.framework/AppCenter'
My understanding of that error is that we are building for the Simulator, so Xcode can't link with a framework built for iOS (non-simulator).
OK fine, so why does Xcode choose the incorrect framework ios-arm64_arm64e_armv7_armv7s in the xcframework? It should choose the correct framework ios-arm64_i386_x86_64-simulator as shown in the folder structure below. How can I make Xcode choose the correct framework for the simulator?
dyoung@Davids-MacBook-Pro AppCenter.xcframework % ls -l
total 8
-rw-r--r--@ 1 dyoung staff 1917 Jul 14 12:19 Info.plist
drwxr-xr-x@ 3 dyoung staff 96 Jul 12 17:01 ios-arm64_arm64e_armv7_armv7s
drwxr-xr-x@ 4 dyoung staff 128 Jul 14 09:52 ios-arm64_i386_x86_64-simulator
drwxr-xr-x@ 3 dyoung staff 96 Jul 12 17:01 ios-arm64_x86_64-maccatalyst
drwxr-xr-x@ 3 dyoung staff 96 Jul 12 17:01 macos-arm64_x86_64
The xcframework Info.plist looks like this:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>AvailableLibraries</key>
<array>
<dict>
<key>LibraryIdentifier</key>
<string>macos-arm64_x86_64</string>
<key>LibraryPath</key>
<string>AppCenter.framework</string>
<key>SupportedArchitectures</key>
<array>
<string>arm64</string>
<string>x86_64</string>
</array>
<key>SupportedPlatform</key>
<string>macos</string>
</dict>
<dict>
<key>LibraryIdentifier</key>
<string>ios-arm64_x86_64-maccatalyst</string>
<key>LibraryPath</key>
<string>AppCenter.framework</string>
<key>SupportedArchitectures</key>
<array>
<string>arm64</string>
<string>x86_64</string>
</array>
<key>SupportedPlatform</key>
<string>ios</string>
<key>SupportedPlatformVariant</key>
<string>maccatalyst</string>
</dict>
<dict>
<key>LibraryIdentifier</key>
<string>ios-arm64_i386_x86_64-simulator</string>
<key>LibraryPath</key>
<string>AppCenter.framework</string>
<key>SupportedArchitectures</key>
<array>
<string>arm64</string>
<string>i386</string>
<string>x86_64</string>
</array>
<key>SupportedPlatform</key>
<string>ios</string>
<key>SupportedPlatformVariant</key>
<string>simulator</string>
</dict>
<dict>
<key>LibraryIdentifier</key>
<string>ios-arm64_arm64e_armv7_armv7s</string>
<key>LibraryPath</key>
<string>AppCenter.framework</string>
<key>SupportedArchitectures</key>
<array>
<string>arm64</string>
<string>arm64e</string>
<string>armv7</string>
<string>armv7s</string>
</array>
<key>SupportedPlatform</key>
<string>ios</string>
</dict>
</array>
<key>CFBundlePackageType</key>
<string>XFWK</string>
<key>XCFrameworkFormatVersion</key>
<string>1.0</string>
</dict>
</plist>