我收到了错误:错误:(键:AnyObject,值:AnyObject)'不能转换为&NSCictionary'。请帮助我解决问题,我尝试了不同的解决方案,但没有成功。
func getLastDayRatesData() -> NSDictionary? {
if var rates = getRatesDataFromPlist() {
if let lastUpdated = rates["last_updated"] as? NSDate{
let ratesWithoutDate: NSMutableDictionary = rates as! NSMutableDictionary
var sortedByDateRates = sorted(ratesWithoutDate) {($0.0 as! String) > ($1.0 as! String)}
if let latestRates = sortedByDateRates.first {
return latestRates // Error: (key: AnyObject, value: AnyObject)' is not convertible to 'NSDictionary'
}
}
}
return nil
}
答案 0 :(得分:0)
刚刚将代码更改为
func getLastDayRatesData() -> (AnyObject, AnyObject)?
一切都很好。