Trying to create a simple WatchKit table, I hit the error shown in this blog post title.
You mileage may vary, but the eventual cause was that when I added my custom RowController class I accidentally added it to the wrong module … I added it to the main iOS app (WatchTest) instead of the Watch extension:
The first hint of this was when I was trying to reference the RowController when calling rowControllerAtIndex, and my custom row controller class could not be found:
var rootRow = rootTable.rowControllerAtIndex(0) as RootRowController
By this time I’d already set it as the RowController class for my table’s row in the storyboard, and had inadvertently referenced the wrong module:
I fixed the compilation error by adding my custom RowController to the Watch extension module, but accidentally added it to both modules:
Everything compiled but when I ran the log shows the error from the title: Error – unable to instantiate row controller class
I eventually figured out my mistake, and made sure that the row controller only belonged to the extension module:
And I made sure the correct module was referenced when defining the RowController in the storyboard:
It would be nice if the Watch App’s storyboard only saw classes in the Watch Extension’s module.