简体   繁体   English

成员'计数'含糊不清

[英]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 将当前的Xcode(v 7.0.1)项目迁移到Xcode 7.1.1时出现以下错误

  • Ambiguous reference to member 'count' 成员'计数'含糊不清
  • Cannot subscript a value of type 'Array' 无法下标'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"]!)! 对成员'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' 另外这个let indexOfEnum : Int = self.arrPromitionDetailEnum.indexOf(dictInfo["r_promotion_detail_type"]!)! // Cannot subscript a value of type 'Array' let indexOfEnum : Int = self.arrPromitionDetailEnum.indexOf(dictInfo["r_promotion_detail_type"]!)! // Cannot subscript a value of type 'Array'

Just remove the : Array part: 只需删除: Array部分:

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

The compiler will infer the right type, which is [Dictionary<String, String>] , not just Array . 编译器将推断出正确的类型,即[Dictionary<String, String>] ,而不仅仅是Array

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM