I am using UITableView inside a View Controller.
In viewDidLoad i have this:
var PlayersUserDefault = NSUserDefaults.standardUserDefaults() if (PlayersUserDefault.arrayForKey("playersKey") != nil){ players = PlayersUserDefault.arrayForKey("playersKey") } and this code gives me error:
func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int { return players!.count } fatal error: unexpectedly found nil while unwrapping an Optional value
I don´t understand this, can someone help me. Sorry, my English is not that good.
players!.countI guess it's returningnilplayers