Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Ambiguous reference to member 'count'

Getting the following error when i migrated my current Xcode (v 7.0.1) project to Xcode 7.1.1

  • Ambiguous reference to member 'count'
  • Cannot subscript a value of type 'Array'

Any idea how to resolve above errors?

My code is as follows

  var arrOfRewardDetail : Array = [Dictionary<String, String>]()
  func tableView(tableView: UITableView, numberOfRowsInSection section: Int) ->  Int {
    return arrOfRewardDetail.count //Ambiguous reference to member 'count'
}

 if self.arrOfRewardDetail[indexPath.row]["KEY"] == "Promotion By : "{} // Cannot subscript a value of type 'Array'

Update Now getting the following errors

  • Ambiguous reference to member 'indexOf' let indexOfEnum : Int = self.arrPromitionDetailEnum.indexOf(dictRewardInfo["r_promotion_detail_type"]!)!
  • Also this one let indexOfEnum : Int = self.arrPromitionDetailEnum.indexOf(dictInfo["r_promotion_detail_type"]!)! // Cannot subscript a value of type 'Array'
like image 626
Rahul Mathur Avatar asked Jan 08 '23 02:01

Rahul Mathur


1 Answers

Just remove the : Array part:

var arrOfRewardDetail = [Dictionary<String, String>]()

The compiler will infer the right type, which is [Dictionary<String, String>], not just Array.

like image 133
Eric Aya Avatar answered Jan 15 '23 01:01

Eric Aya