My project compiled fine but after upgrading to Xcode 11.4 it now fails to compile with this error for each of my frameworks:
Building for watchOS, but the linked framework 'MyFramework.framework' is building for iOS. You may need to configure 'MyFramework.framework' to build for watchOS.
I have 3 frameworks. Each have a watch version target which is already configured to use watchOS
as the base SDK.
What is XCFramework? Apple defines XCFrameworks as a distributable binary package created by Xcode that contains variants of a framework or library so that it can be used on multiple platforms (iOS, macOS, tvOS, and watchOS), including Simulator builds.
To include a framework in your Xcode project, choose Project > Add to Project and select the framework directory. Alternatively, you can control-click your project group and choose Add Files > Existing Frameworks from the contextual menu.
Remove the architectures (using lipo -remove ) that aren't necessary for the device slice of the XCFramework. Remove the architectures (using lipo -remove ) that aren't necessary for the simulator slice of the XCFramework. Combine the two slices into an XCFramework using xcodebuild -create-xcframework .
I removed each framework and added them back, and it compiles fine now.
The project.pbxproj
changes added:
3B2AD3CA242D1EEA00C436C8 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 4CAF2B4E1B32D6F400489ACE /* Project object */;
proxyType = 1;
remoteGlobalIDString = 3B1303E423CE4DA900405D89;
remoteInfo = "MyFramework Watch";
};
and
3B2AD3CB242D1EEA00C436C8 /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
target = 3B1303E423CE4DA900405D89 /* MyFramework Watch */;
targetProxy = 3B2AD3CA242D1EEA00C436C8 /* PBXContainerItemProxy */;
};
For each framework.
I also filed a bug report with Apple Feedback and they closed it saying I was able to fix it myself.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With