WatchKit can't initiate viewcontroller from Storyboard

Since updating to Xcode 10, my WatchKit app is broken.


Every time I try to start the app I get the following error message:


-[SPRemoteInterface createViewController:className:properties:contextID:info:gestureDescriptions:clientIdentifier:]:2909: Couldn't instantiate class _TtC32WatchKit_App_Extension19InterfaceController

2018-10-01 21:51:41.579080+0200 WatchKit App Extension[2457:27053] [default] -[SPRemoteInterface createViewController:className:properties:contextID:info:gestureDescriptions:clientIdentifier:]:2910: Critical failure. Simulating crash: Condition failed:"NO". Couldn't instantiate class _TtC32WatchKit_App_Extension19InterfaceController

(lldb)


The viewcontroller is the initial viewcontroller set in the Storyboard file and the all targets, modules etc. are set correctly in the Storyboard and in the Inspector as far as I can tell.


I created a new project with the same WatchKit Extension setup and I can start that app - it's just a problem with my existing project, where I've added an app extension.


Also tried to delete the app extension and add a completely new one to my iOS project, but with no success.


Does anyone have any suggestions on how to get this to work?

Replies

Of course you did a Clean Build Folder ?


Could yopu post the func where the error occurs ?

I have the same issue. I needed to rename a working Watchkit project in XCode 10.

Used the automatic name change for the project file and manually reset all the modules and checked all the targets. Also changed the plist names in Build settings


I get the same error from failure to instantiate the initial view controller


No clues found in a SO search

Same issue as well. I added a watch target back in Xcode 9 which was fine, but now under Xcode 10.1 it's not recognizing the main interface storyboard with a similar error as the original post above.


Fixed: I had to re-create the Interface.storyboard in the end. Nothing would fix it until I did this. The previous version of the storyboard had an older form of a notification controller that is different in Xcode 10.1.

I could fix the interface storyboard by open it in a text editor. Have a look for


customModule="..."


That should contain the new names of your targets. Spaces in your names are replaced by "_".

That fixed the above errors for me.

  • That should be accepted as answer. This fixed the issue for me as well.

    PS: You can also right-click the storyboard file, select Open As > Source Code and search and replace right inside of Xcode.

Add a Comment

For me it was the same.


I created the extension, choice swift and added it to a objective c project.


Xcode created the target with space in it (watch extension), which it couldn't handle I renamed it WatchExtension


Error when space is in name:

<unknown>:0: error: module name "Watch Extension" is not a valid identifier

Command CompileSwiftSources failed with a nonzero exit code


Remove space in nameget the runtime error:

Condition failed:"NO". Couldn't instantiate class _TtC32WatchKit_App_Extension19InterfaceController


To fix I had to go to the watch (ui) target.

Build Settings-> select all -> search for "default Module" and rename it to your watch extension name.


Also renamed folder to match extension name etc.

Thanks, BooRanger. Your suggesion helped me too. I finessed it a little by setting "Default Module" on the app to "$(PRODUCT_MODULE_NAME)" to insulate it from any future module name changes. This worked for me.

I had this message when I had two different targets one for the main app one for a "Lite" version, both using the same storyboard and WKInterfaceConrollers. I cured it by going through the storyboard and for each scene, in the Identity Inspector, setting "Inherit Module From Target. You also need to do this for any ListRowControllers