Couldn't instantiate class _TtC12STracker23InfoInterfaceController

天大地大妈咪最大 提交于 2020-05-18 03:49:38

问题


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:

  1. go to interface.storyboard located at left navigator pane in Xcode

  2. select the yellow circle on top of a interfaceController

  3. go to it's identity inspector
  4. 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)
  5. 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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!