在更新到 xcode 7.3 后,我正在更新我所有的 swift 语法在此过程中,我遇到了一些错误ambiguous use of subscript swift
,我相信这个错误也是导致信号故障的原因。
有问题的代码:
override func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) {
var arry:NSArray = Array(self.participants)
arry = arry.sort {
item1, item2 in
// ambiguous use of subscript swift error for both these lines
let date1 = item1["fullName"] as String
let date2 = item2["fullName"] as String
return date1 > date2
}
编辑
声明participants
来自另一个控制器:
func gotoMembers(){
let set:NSSet = self.conversation.participants
let arr = set.allObjects //Swift Array
UserManager.sharedManager.queryForAllUsersWithCompletion(arr as! [String], completion:{ (users: NSArray?, error: NSError?) in
if error == nil {
//participants declared here and passed into the participant controller
let participants = NSSet(array: users as! [PFUser]) as Set<NSObject>
let controller = ParticipantTableViewController(participants: participants, sortType: ATLParticipantPickerSortType.FirstName)
controller.delegate = self
self.navigationController?.pushViewController(controller, animated:true);
} else {
appDelegate.log.error("Error querying for All Users: \(error)")
}
})
}
更新