Search code examples
swiftios10

__NSCFString nsli_lowerAttribute:intoExpression:withCoefficient:forConstraint: this occur in ios 10 only


I have made one application which is working good in ios 11 but when i try to run this in ios 10. It suddenly start crashing and give this error.

-[__NSCFType nsli_lowerAttribute:intoExpression:withCoefficient:forConstraint:]: unrecognized selector sent to instance 0x600000199cc0

I try to trash issue but don't know why this is occur. In exception breakpoint it show me below place

 func showFullScreenLoading(inView objView:UIView?,withMsg strMsg:String = "Please wait!!!")
    {
        guard let view = objView else
        {
            return
        }

        let objParentView = UIView.init()
        objParentView.translatesAutoresizingMaskIntoConstraints = false
        objParentView.backgroundColor = UIColor.white.withAlphaComponent(0.2)
        objParentView.tag = -123456
        view.addSubview(objParentView)

        view.addConstraints(NSLayoutConstraint.constraints(withVisualFormat: "V:|[objParentView]|", options: [], metrics: nil, views: ["objParentView":objParentView])) //At this line exception error
        view.addConstraints(NSLayoutConstraint.constraints(withVisualFormat: "H:|[objParentView]|", options: [], metrics: nil, views: ["objParentView":objParentView]))
}

Calling of the function

 func apiCalled(_ objOperation:TagApiOperation){

    self.currentRequest = objHomeViewModel.apiCallHome(objOperation: objOperation, withDictData: [:], withLoaderBlock: { (isStart) in
        if isStart{
            SINGLETON.showFullScreenLoading(inView: self.view) // I called this function in view did load and there will be no background thread are there
        }else{
            SINGLETON.hideFullScreenLoading(inView: self.view)
        }
    }) { (isStatus, strMsg, arrBanner) in

     }
}

Solution

  • Finally i got the solution this issue occur because of safe area. safe area available from ios 11 so if you have ios 10 supported application then disable the safe area.