![](/img/trans.png)
[英]NSInvalidArgumentException, reason unrecognized selector sent to instance
[英]MDC crashing with 'NSInvalidArgumentException', reason: '-[UIButton applyOutlinedThemeWithScheme:]: unrecognized selector sent to instance
从错误中,您可以看到UIButton
没有名为applyOutlinedThemeWithScheme
的方法,这可能意味着在您的故事板或 XIB 中,您使用的是 UIButton 而不是 MDCButton。
在您的故事板或 XIB 中,转到 Identity Inspector,确保Class
设置为MDCButton
。
我遇到了同样的问题。 但我是通过代码构建用户界面的。
import MaterialComponents.MaterialButtons
import MaterialComponents.MaterialButtons_Theming
let button = MDCButton()
button.applyTextTheme(withScheme: MDCContainerScheme())
以下帮助了我。 我刚刚调用了选项Product -> Clean Build Folder
。 之后,程序异常终止的现象就消失了。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.