swift3.0 fatal error: unexpectedly found nil while unwrapping an Optional value报错解决

swift3.0 fatal error: unexpectedly found nil while unwrapping an Optional value报错解决,第1张

概述通过xib加载view时在init中使用了@IBOutlet weak var bgView: UIView! 就崩溃了,输出信息如下: fatal error: unexpectedly found nil while unwrapping an Optional value 就是打开了一个没有初始化的值 解决办法有两个: 一、删除weak将控件默认声明为strong 二、刷新控件的 *** 作放到la

通过xib加载vIEw时在init中使用了@IBOutlet weak var bgVIEw: UIVIEw!

就崩溃了,输出信息如下:

Fatal error: unexpectedly found nil while unwrapPing an Optional value

就是打开了一个没有初始化的值

解决办法有两个:

一、删除weak将控件默认声明为strong

二、刷新控件的 *** 作放到layoutSubvIEws中

总结

以上是内存溢出为你收集整理的swift3.0 fatal error: unexpectedly found nil while unwrapping an Optional value报错解决全部内容,希望文章能够帮你解决swift3.0 fatal error: unexpectedly found nil while unwrapping an Optional value报错解决所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址:https://www.54852.com/web/1069741.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2022-05-26
下一篇2022-05-26

发表评论

登录后才能评论

评论列表(0条)

    保存