![](/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.