Watchkit app extension issue & solution (iOS)

We’are going to solve all of the following issues:
Error: WatchKit App doesn’t contain any WatchKit Extensions
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.
Invalid WatchKit Support – The expected app is missing from the app’s root location, such as /Payload/appname.app/Watch

Wasted 3 days with the above errors & issues. To solve those, I’ve modified the extension identifier so that it has watchkit’s identifier as prefix. This is because, unless identifiers are prefix, those won’t be allowed to embed on Xcode settings.

Check list:

1. In main iOS app settings on general tab, add your watchkit app in the embedded binaries section. Note that, if you ever deleted build folder, the embedded watchkit app may not be displayed in this section even if you just added there.

App Settings, General Tab
App Settings, General Tab

2. Make sure you see the watchkit app both in target dependancy & embedded binaries section. If not, add them on the build phases tab of your iOS app.

App Settings, Build Phases Tab
App Settings, Build Phases Tab

3. Now on settings of watchkit app, add your extension in the embedded binaries.

Watchkit Settings, General Tab
Watchkit Settings, General Tab

4. You should see the watchkit extension both in target dependancy & embedded binaries section. If not, add them on the build phases tab of your watchkit app.

Watchkit Settings, Build Phases Tab
Watchkit Settings, Build Phases Tab

5. On build settings of the extension, make sure bitcode is enabled. Base sdk should be latest iOS sdk.

Watchkit Extension Settings, Build Settings Tab
Watchkit Extension Settings, Build Settings Tab

6. See the watchkit app identifier is a prefix of the extension. I’ve renamed the product module (both for watchkit app & extension) to avoid spaces.

"Watchkit
Build Settings > Packaging” class=”size-full” /> Watchkit Extension > Build Settings > Packaging

You should now be able to build or archive with proper mobile provisions. By the way, my Xcode version is 9.3 & I’m using Objective C.