在 nsmutable 数组的情况下,找不到接受提供的参数的 'subscript' 的重载

Could not find an overload for 'subscript' that accepts the supplied arguments in case of nsmutable array

我是 Swift 的新手,你能告诉我为什么会出现这些错误吗

{
var profArr : NSMutableArray = NSMutableArray()


for index in 1...<profArr.count
        {
            var joomlaID : NSString = [dbManager?.getZoomlaID(profArr[index]["firmUserId"] as String)];  

// while using this in loop getting **could not find overload**  error.
        }



func getZoomlaID (firmUser : NSString) -> NSString
    {
        var zoomlaId : NSString

        var dbPath: AnyObject? = NSUserDefaults.standardUserDefaults().valueForKey("dbPath")

        var db = FMDatabase(path: dbPath as! String)

        db?.open()

        if var rsltSet : FMResultSet! = db!.executeQuery("Select JoomlaUserID From org_firm_users where FirmUserID like ('\(firmUser)')",  withArgumentsInArray: nil)  //Here again getting error Unprintable ASCII character.
        {
            while (rsltSet.next())
            {
                print(rsltSet.resultDictionary())

                zoomlaId = (rsltSet.resultDictionary() as NSDictionary).valueForKey("JoomlaUserID") as! NSString     
            }
        }

        else
        {
            println("select failed: \(db.lastErrorMessage())")
        }

        db?.close()

        return zoomlaId
    }
}

for index in 1...<profArr.count 行中,您在循环声明中添加了不需要的 .<,它应该是这样的:for index in 1..profArr.count

... 表示从-到包含,.. 表示从-到不包含。

例如1..3 表示 1,2,3 但 1..3 表示 1,2