分段错误:Xcode升级后为11

时间:2018-12-16 20:37:46

标签: swift xcode segmentation-fault

请针对此错误消息提供帮助:

  1. silgen发出Function SIL函数“ @ $ S6QRCart6CartVCC9tableView_12cellForRowAtSo07UITableE4CellCSo0jE0C_10Foundation9IndexPathVtF”。 用于/ users / Stenly / Downloads / QRCartGeo / QRCart / CartVC的'tableView(_:cellForRowAt :)'。swift:89:5 错误:细分错误:11

这是我的代码:

func tableView(_ tableView: UITableView, cellForRowAt indePath: IndexPath) -> UITableViewCell {

    // Parents
    let cellIdentifierParents = "cell"

    let CartCell: CartCell? = tableView.dequeueReusableCell(withIdentifier: cellIdentifierParents) as? CartCell
    let cellObject = loadedCart[indePath.row]
    CartCell?.selectionStyle = .none
    CartCell?.lblItem.text = (cellObject as AnyObject).object(forKey: "item") as? String
    CartCell?.lblSize.text = (cellObject as AnyObject).object(forKey: "size") as? String
    CartCell?.lblPrice.text = ((cellObject as AnyObject).object(forKey: "price") as? String!)! + " €"
    CartCell?.lblPrice.text = CartCell?.lblPrice.text?.replacingOccurrences(of: ".", with: ",")

    var total = Float()
    for item in loadedCart {
        let price : NSString = ((item as AnyObject).object(forKey: "price") as? NSString)!

        let priceTruncate = price.replacingOccurrences(of: "€", with: "")

        let a:Float? = Float(priceTruncate)
        total = total + a!

        self.lblTotalOfCart.text = String(format : "SE: %.2f €",total)
        self.lblTotalOfCart.text = self.lblTotalOfCart.text?.replacingOccurrences(of: ".", with: ",")
    }
    let deleteItem = UITapGestureRecognizer(target: self, action: #selector(self.deleteItem(_:)))

    CartCell?.btnRemoveOutlet.addGestureRecognizer(deleteItem)

    CartCell?.btnRemoveOutlet.isUserInteractionEnabled = true;
    return CartCell!

}

0 个答案:

没有答案