Wednesday, 31 July 2019

Errors in iOS



Errors : 

1) Expression type '@lvalue CGRect' is ambiguous without more context

Code: 

Wrote this code in JSON response 
if status == "SUCCESS" {
    self.myTableView = UITableView(frame: CGRect(x: 0, y: 0, width: self.subView.frame.width, height: tblViewDescArray.count*50)) //Error comes here self.subView.frame.width
    self.subView.addSubview(self.myTableView)

Solution :  https://stackoverflow.com/questions/51140220/swift-4-expression-type-value-cgrect-is-ambiguous-without-more-context

let width = self.subView.frame.width
                                
self.myTableView = UITableView(frame: CGRect(x: 0, y: 0, width: Int(width), height: self.tblViewDescArray.count*50))

2) Thread 1: Fatal error: Unexpectedly found nil while implicitly unwrapping an Optional value


Solution : Here tableView IBOutlet not available in this VC.

No comments:

Post a Comment

Difference between == and ===

Difference between == and === https://stackoverflow.com/questions/24002819/difference-between-and == operator checks if their ...