Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Use Cocoa Touch Framework in iOS and WatchKit

I have a Cocoa Touch Framework that I developed for using in both my iOS app and my WatchKit app on iOS 8. I have no problems with iOS 8, however when I move the project to iOS 9 and update the WatchKit app to run natively I get the following error:

ParkFinderKit was rejected as an implicit dependency for 'ParkFinderKit.framework' because it doesn't contain platform 'watchsimulator' in its SUPPORTED_PLATFORMS 'iphonesimulator, iphoneos'

I attempted to manually add watchossimulator and watchos to the list of supported platforms: Configured Supported Platforms

However this produces another error:

ParkFinderKit was rejected as an implicit dependency for 'ParkFinderKit.framework' because its SDK is platform 'com.apple.platform.iphonesimulator' and it needs to match platform 'com.apple.platform.watchsimulator'

Any ideas as to how to solve my issue?

like image 726
g0ld2k Avatar asked Jul 02 '15 14:07

g0ld2k


People also ask

What is Cocoa Touch framework in iOS?

Cocoa and Cocoa Touch are the application development environments for OS X and iOS, respectively. Both Cocoa and Cocoa Touch include the Objective-C runtime and two core frameworks: Cocoa, which includes the Foundation and AppKit frameworks, is used for developing applications that run on OS X.

Can I make my own Apple Watch app?

To build a watch-only app, start a new project in Xcode, select the Watch App template, and click Next. Provide a name, and choose the interface, life cycle, and language for your watch app. Select the options to include a notification scene template or unit and user interface tests, and click Next.


1 Answers

Okay, it looks like you cannot use a Cocoa Touch Framework inside of a WatchKit app. I was able to get around this by creating a new Watch Framework target and then assigning each file from the original framework to the new framework in the Target Membership options.

enter image description here

This accomplishes my goal of sharing code between iOS and WatchKit without having duplicate code.

like image 162
g0ld2k Avatar answered Oct 10 '22 23:10

g0ld2k