Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Xcode 11.4: Building for watchOS, but the linked framework 'MyFramework.framework' is building for iOS

Tags:

ios

xcode11.4

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.

like image 825
Michael Ozeryansky Avatar asked Mar 26 '20 16:03

Michael Ozeryansky


People also ask

What is XC framework in iOS?

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.

How do I link a framework in Xcode?

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.

How do I convert .framework to XCFramework?

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 .


1 Answers

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.

like image 131
Michael Ozeryansky Avatar answered Nov 22 '22 17:11

Michael Ozeryansky