我正在试图在Swift中循环NSMutableArray
。但是为什么我会在这样的简单情况下得到这个错误:
// note : `responseObject:AnyObject!`
var temp = NSMutableArray(array: responseObject as! [AnyObject])
for a:NSDictionary in temp { // @lvalue NSMutableArray' is not convertible to 'SequenceType'
// Do some stuff here...
}
答案 0 :(得分:1)
这应该有效:
var temp = NSMutableArray(array: responseObject as! [AnyObject])
for a in (temp as NSArray as! [NSDictionary]) {
// 'a' is of type 'NSDictionary'
// Do some stuff here...
}