WatchKit app wont run on simulator

2019-02-16 11:48发布

问题:

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 kept getting this error and didn't know why after searching all the other questions here, took forever to figure this out.

回答1:

The solution was really simple. A while back I had removed a few files and re-added them to the extension, but they didn't get added back to compile sources.

Added the exention's .m files back into it's compile sources and the error went away.

Very misleading error message.



回答2:

this solved the problem for me:

  • go to WatchKit Extension | Build Phases | Copy Bundle Resources
  • click the +
  • search the products folder and choose WatchKit App.app

afterwards clean and rebuild



回答3:

I had the same issue.

My problem was that by renaming target, I ended up with the same Product Name for the Main app and the Watchkit App, resulting in overriding themselves while building.

So everytime I cleaned the build, on the first install it was actually working, but on the second one I was alwas getting this Error.

When I realized the problem, I also found out that Renaming the product name of the WatchKit App wasnt fixing the issue because XCode doesnt really update all the references to the WatchKit Extension target, maybe there will be a fix later for this. (At the moment i am using XCode 6.3.1)

Renaming the Product Name of the main app to a different name, fixed anyways the problem.

Afterwards cleaned and rebuilt and never had that problem again.



回答4:

I had to change the compiler for extension & watch app, probably because I added Watchkit App to old project.

Go to Build Settings "Compiler for C/C++/Objective-C" of extension and watch app, and make sure it's "Default Compiler".



回答5:

I had changed the autogenerated Bundle ID and then hit the same error.

I found that the value in the WatchKit Extension plist needed to get updated. Do a global search on this "WKAppBundleIdentifier" and then make it match the bundle id of your WatchKit app. This fixed the error for me.



回答6:

I was able to fix this error by removing the extension's binary from "Embedded Binaries" in Main App's "General Settings".

I think that was still in there from the time I created the watch-target, which was for Watch OS 1.



回答7:

After weeks and weeks of investigations i finally found out the problem.

The product name of the Iphone App was the same as the product name of the Watch App.

Once i changed the Product Name of the WatchApp it worked.

  1. go to your targets. Select the watch app target
  2. go to build settings. Search for Product Name
  3. Edit your Product name to be different than the App Target!
  4. Clean and Build. Should Work. Thanks


回答8:

I found that in extension sources it was pointing to Debug-iphoneos location of WatchKitApp so readding it fixed the problem



回答9:

I recently came across this error and after spending many hours trying to get away with it, it seems I finally managed. Read about the solution here: https://blogofpuneet.wordpress.com/