The data of namesArray
and descriptionArray
getting from previous VC.
I have set the delegate
and datasource
of my tableview but I am getting an below error
Unexpectedly found nil while unwrapping an Optional value
var namesArray: [String] = []
var descriptionArray: [String] = []
@IBOutlet weak var tblProjectList: UITableView!
override func viewDidLoad() {
super.viewDidLoad()
print(namesArray.count)
self.tblProjectList.delegate = self
self.tblProjectList.dataSource = self
}
namesArray
has data but why at self.tblProjectList.delegate = self
app got crashed.
再次删除并创建tableview插座。
Check your IBOutlet is connected to TableView. Sometimes it gets disconnected.
The process to check:
If you are getting
"Unexpectedly found nil while unwrapping an Optional value"
Than there is some issue with cell identifier, array index not set proper. You can check this both scenario.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.