Prevent deploying (disable) WatchKit App with iOS iPhone App in Xcode
Asked Answered
S

2

76

We've got an Xcode project with build configurations for the Apple Watch as well. Our Apple Watch app isn't ready yet, so we'd like to release with it disabled. What's the best way to disable Apple Watch functionality in a build?

Strode answered 24/5, 2015 at 17:50 Comment(0)
P
146

Remove the WatchKit extension

To make sure that your WatchKit extension is no longer visible, you have to do two things:

1) Remove the WatchKit extension from "Target Dependencies"

  • (To go to Target Dependencies: in the project navigator, click the project file. Then click the target of the iPhone app. Go to the Build Phases tab.)

2) Remove the WatchKit extension from "Embed App Extensions" (in Xcode 7+, "Embed Watch Content")

  • (In Build Phases, go to Embed App Extensions. Remove the WatchKit extension entry from the list Embed App Extensions.)

Finally, you may have to clean your build folder. Then build and run your iPhone application.

To re-add the WatchKit extension:

For watchOS1: FIRST, add your WatchKit extension to Target Dependencies. This re-creates the .appex file that you can now add to the list under Embed App Extensions by pressing the plus button and choosing "App Name WatchKit Extension.appex".

For watchOS2: Just add your WatchKit extension to Target Dependencies.

Remarks:

  • I have tried the whole process of removing and recreating the extension both in the simulator and on the actual devices (iPhone and Apple Watch). It worked in both cases.
  • I have also tried to do either A or B but that was not sufficient.
  • I used Xcode version 6.3.2
Plenum answered 25/5, 2015 at 9:33 Comment(9)
@Gaurav: You are welcome! I just realized that adding the .appex file later in the way I described causes a problem when building the application on another Mac. I have therefore changed the description. It's easier now and it works.Plenum
Hi vomako, I had done this process originally, but now, after adding the watchkit app back to my project, for some reason I'm seeing two watch app binaries in my app store ipa. Could you please have a look at this question that I posted? Thanks!! - #30519213Coolie
Note that in Xcode 7 and watchOS 2.0 you must also remove the watch app entry in the "Embed Watch Content" section.Crackup
@DylanHand hi I couldn't find Embed App Extensions in Xcode 7.Tache
@Tache you can find the Embed App Extensions by clicking your project, then finding your iOS target and going to the Build Phases tab.Crackup
@moseth I don't think it's still there in Xcode 7 and as long as you remove the other 2 stuff you should be good.Jugendstil
@Jugendstil I removed WatchKit from "Target Dependencies" and "Embed Watch Content". However, watch app is still available on my app. How do I remove it?Tache
@vomako Works charm..."Target Dependencies" and "Embed Watch Content" removed and working perfect using Xcode 7.3 iOS 9.3.Adulterous
Special note for Cordova users: you also need to set "Embedded content contains Swift Code" to NO in Build Settings.Lumisterol
C
4

The above answer is correct but if you are not able to figure out the first point.

1) Remove the WatchKit extension from "Target Dependencies".

It means to go to your target, select build phases, then click Dependencies. remove watch dependency

NOTE Even better way is to just search 'watch' keyword in Main Target -> Build phases. The dependencies and embed watch content will be listed. Just remove them

Cupule answered 26/11, 2021 at 21:7 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.