问题
I try to build my watch app and I keep getting an error
createViewController:className:properties:contextID:info:gestureDescriptions:
clientIdentifier:]:2916: Critical failure. Simulating crash: Condition failed:"NO".
Couldn't instantiate class _TtC12STracker23InfoInterfaceController
I had to rename my project at some point and according to my research it can be the cause of the problem. I recreated from scratch the Interface.storyboard and InfoInterfaceController but it did not help.
回答1:
So I've solved the problem by deleting all watch targets and files and recreating them
回答2:
That is not a good way to solve such problems specially when someone has bigger WatchOS App Project and deleting all and recreating is absurd and time consuming.
first check if you did rename your project correctly by following steps in this answer by Luke West: https://stackoverflow.com/a/35500038/7345611
then do these steps:
go to interface.storyboard located at left navigator pane in Xcode
select the yellow circle on top of a interfaceController
- go to it's identity inspector
- in class section, reassign your class to that interfaceController by retyping the class name and hitting enter which Xcode will updates the module section under it automatically. (all your problem lie in Module Section where Module still has the old name assigned to it)
- do the same process for all interfaceControllers and customClasses(if you have any) and everything that you assigned a class to it before.
now the app should run as expected.
来源:https://stackoverflow.com/questions/56427829/couldnt-instantiate-class-ttc12stracker23infointerfacecontroller