How to configure standalone watch app with optional companion app?

I want to develop an independent app for watchOS, which also has an optional companion app to communicate on iOS.

I added a "Watch App" to my targets. Then I followed the demo project to add WatchConnectivity functionality.

Then on launch I get the following message:
Could not install at this time.

WatchKit apps specifying WKWatchOnly = YES in their WatchKit app extension's Info.plist cannot also have WKCompanionAppBundleIdentifier in the app's Info.plist.


According to this thread, it is possible to use WKRunsIndependentlyOfCompanionApp. Is it possible to put this as a standalone watch app on the store when combined with WKWatchOnly = NO?


Is the suggested way to use the target template "Watch App for iOS App" for the case of communicating though independent apps?

Replies

Would check out the WWDC video at 7:30 for a companion app that can optionally run independently.

https://developer.apple.com/videos/play/wwdc2019/208/


Basically, in the watchkit extension target, just select 'Supports Running Without iOS App Installation'. This should set the info.plist parameters properly.


If your watch app might need to communicate with the iPhone also (even though you also want it to run independently), then you should create the watch app by starting with 'iOS App With Watch App' template.

If your watch app will not need to communicate with the iPhone at all, then use the 'App' template for a truly independent watch app.