Reputation: 5936
Whenever I make any connections in my subclass of WKIInterfaceController
I get error WatchKit error - unable to find interface controller class 'myClass' to instantiate
and a activity indicator showing in simulator and the view does not load. Disconnect all conections and the view displays correctly but still get the error
Tried
Unable to find interface controller class 'InterfaceController' to instantiate
WatchKit: unable to find interface controller class
WatchKit reloadRootControllersWithNames causing error, with pageController or after push/pop
Two links suggests a bug, If it is a bug this would surely not be present on the release version of XCode and everyone would experience the same behaviour rendering watcKit all but useless?
Upvotes: 23
Views: 12525
Reputation: 161
the accepted answer didn't work for me.
I did answer it completely In this post: https://stackoverflow.com/a/61517773/7345611
but I did put the part related to this question here:
The best approach that worked for me is:
go to interface.storyboard located at left navigator pane in Xcode
select the yellow circle on top of a interfaceController
now the app should run as expected.
Upvotes: 0
Reputation: 1312
Make sure the module name in storyboard is same as .appex file under tagerts/XXX WatchKit App General Tab -> Frameworks, Libraries, and Embedded Content.
Upvotes: 0
Reputation: 3221
Just drove myself nuts over this for a couple of hours. Followed all the suggestions here, no luck.
What ended up for me is what I should have done in the first place - I cleaned the build folder.
Product > Clean Build Folder
Upvotes: 0
Reputation: 21
The problem here is that we set the module for the interface controllers incorrectly. Since those controllers belong to Watch Extension target, we can find the product module as below
Image to show how to find the product module name
Once we have the module name, just go ahead and set it for each interface controller
image to show how to set the product name
Upvotes: 2
Reputation: 711
1. select your WKInterfaceController
2. select Inherit Module From Target
Upvotes: 2
Reputation: 7246
After adding new Interface controller in WatchOS, above issue is occurred due to wrong
"Module Name in Custom Class" :-
After changing the module to extension above issue is resolved.
Upvotes: 12
Reputation: 514
Just look target for both class and interface. It should be set to Extension that's all
Upvotes: 1
Reputation: 6373
Clicking in my Watch storyboard > Interface controller Scene > Identity Inspector (the middle icon, from the 5 icons that appear on the menu at the right of Xcode) > Set Module to "[YourProjectName]Extension" worked for me!
Upvotes: 1
Reputation: 1197
You need to verify the view controller is in your compile source here: Select Project > Select Watchkit Extension Target > Build Phases > Compile Sources
Upvotes: 1
Reputation: 10380
When you create your glance interface controller, be sure to add it to the the Watch App Extension. This was my problem.
Upvotes: 1
Reputation: 4546
I fixed it by clearing the module name in the storyboard for that specific interface class. (Which is a objective-c class).
Upvotes: 0
Reputation: 9913
Make sure you make the new Class member of the EXTENSIONS while you are creating the class.
Upvotes: 0
Reputation: 6084
In my case I renamed Watch Kit Extension
to WatchKitExtension
, and it was running succesfully on simulator, but failed to run after full project clean.
Thanks to https://stackoverflow.com/a/29904047/104170.
In order to make it work I just needed to specify correct module in my .storyboard
file
Upvotes: 2
Reputation: 769
I solved this issue by:
1) deleting trouble-making InterfaceController file and creating it again in the folder for WatchKit Extension in the project (not just in a group in Project navigator). By default xcode gives you Watch App folder - you have to change it.
2) setting class in Interface Builder so that module was set to ProjectName_WatchKit_Extension
If module is not set - xcode won't be able to find your class
Upvotes: 42
Reputation: 5936
For anyone else who has this. The class must be set to the correct target membership ie yourApp WatchKit Extension
rather than yourApp WatchKit App
when creating your class. It can also be edited in Target membership in interface builder.
Upvotes: 25
Reputation: 293
I was having same issues after the recent 8.2 release. I had to go to each one of my InterfaceControllers and adjust its custom class module to whatever was shown as an option or "none".
Upvotes: 16