Archive error: WatchKit Extension doesn't contain any WatchKit apps

With great effort, I managed to build one of my Apple Watch capable apps with both the WatchKit 1 targets for running on iOS 8.4 and the WatchOS 2 targets for running on iOS 9. I can debug the app on a physical iPhone and Apple Watch running 8.4 as well as debug on the 9.0 simulators for iPhone and Watch.


However, when I archive the project, ValidateEmbeddedBinary throws the error: WatchKit Extension doesn't contain any WatchKit apps. Verify that the value of WKWatchKitApp in your WatchKit App's Info.plist is set to YES.


I dug down into the derived data build artifacts, drilling into the packages and it clearly shows the Info.plist for the WatchKit app having WKWatchKitApp set correctly. I have checked that each of the 5 target Info.plist are being built from the correct folders.


I have a shell of a dual watchkit app that archives just fine. Comparing the 5 plists in the shell to my fulll app shows no differences. Same issue whether running Xcode 7 GM or beta 6.

Adding WKWatchKitApp to the WK1 extension's Plist did not make any difference. Removing WKWatchKitApp from the WatchOS2 extension also did not help. It's not clear whether this setting is needed in both targets


I filed bug 226452134 with Apple. Since they haven't looked at another related bug report regarding dual build watchkits that I filed over 3 weeks ago, I don't expect any resolution to this one soon.

Replies

I have the same problem. I am absolutely stuck. Initially, I reconstructed my project from scratch and this worked for a while. Now the project file seems to have gone bad. I'm thinking of trying the following solutions:


1) Go to a backup where things worked and then reinstall my updates one by one.

2) Create a separate XCode project for each target. The problem seems to be related to having more than one target and a WatchOS 1.0 app

3) Continue hacking until I get a build

4) Dropping support for Apple Watch until this bug is fixed.


This bug seems to appear sometimes with device builds. I'm able to work around it by building a second time. However, I have not been able to work around the issue for archiving.


It would be really nice if Apple could fix this bug or at the very least divide this one generic error message into several that are more informative. It would be nice if the message told us, for example, which deployment versions didn't match or which bundle IDs are wrong. It might be nice if a separate code were printed for each case that jumps to the point that prints this error in the ValidateEmbeddedBinary tool.


This bug has wasted a considerable amount of my time. I have a release ready to go but will have to spend a day or two trying to find a work around.


- Ken

After a build fails to fix it, have you tried to exit and restart Xcode? I've had several build issues that this fixed (sadly.)


Also, are you using Xcode 7.2?

Did anyone find a solution to this issue?

Strugling for two days, tried all solutions with no luck

😠

For anyone still struggling with this, I was having this issue and managed to sort it out. For me, it seemed to be caused by a race condition between copying the bundle resources in and verifying the WatchKit app. I was able to fix it permanently by inserting a Run Script build phase to sleep for 5 seconds, in between the "Copy Bundle Resources" and "Embed App Extensions". This is in the main app target.


Looking around, it looks like this error message is a bit of a giant catch-all for different problems, lots of people have found different solutions. One thing to check would be to go into your build/Release-iphoneos folder. Ideally you should be able to see that the main app, watchkit extension and watchkit app are there and also have embedded copies like this:


YourApp WatchKit App.app

YourApp WatchKit Extension.appex

YourApp WatchKit Extension.appex/YourApp WatchKit App.app

YourApp.app

YourApp.app/Plugins/YourApp WatchKit Extension.appex

YourApp.app/Plugins/YourApp WatchKit Extension.appex/YourApp WatchKit App.app


If they are all there you may have a race condition like I did. If not, which files are missing should provide a clue to where things are going wrong. Of course build warnings prior to the error message may also provide clues.


Good luck!

I think I found it.


In your app's target's Build Pahses.

Change the order of the "Embed App Extensions" position to right under "Target Dependencies".

In my case it was last after all the other operation, that casued the race condition.


Target dependencies get's your watch extention built before your containing app,

calling embeding right after assures that the race condition it cancelled and seems to fix the problem.


happy coding!

Thanks, this solved it for me. I could swear I did nothing and it failed all of a sudden.