脸一些误差在我的迅速3代码线程1:EXC_BAD_INSTRUCTION(代码= EXC_1386_INVOP,子码=为0x0),这是我的
问题描述:
func initProducts(cateories: Categories){
products = DataServices.instance.getProducts(forCategorieTitle: cateories.nameLabel)
//productTitleName.text = cateories.nameLabel
self.productTitleName!.text = cateories.nameLabel
}
在本节我是面对这一误差的误差。脸一些误差在我的迅速3代码线程1:EXC_BAD_INSTRUCTION(代码= EXC_1386_INVOP,子码=为0x0),这是我的
答
使用这样的:
if let productTitle = self.productTitleName {
productTitle.text = cateories.nameLabel
}
+0
这不能解决实际问题。它只是避免了崩溃。 – rmaddy
是'填充self.productTitleName'? – tadman
我认为productTitleName outlet不会与UI元素连接,请检查它是否尝试分配“productTitleName?.text”而不是“productTitleName!.text” – Bharath