swift 开发过程中犯过的错误记录
发布时间:2020-12-14 01:50:38 所属栏目:百科 来源:网络整理
导读:1.嵌套数组使用过程中的错误 错误提示:Cannot assign to immutable value of type 'String' Could not find member 'subscript' 如下图 当然这样写问题很大的,这里要说的重点是第一重字典后面的as后面应为“!”,而不能为"?",正确写法如下: // //与下面的
1.嵌套数组使用过程中的错误 错误提示:Cannot assign to immutable value of type 'String' Could not find member 'subscript' 如下图
当然这样写问题很大的,这里要说的重点是第一重字典后面的as后面应为“!”,而不能为"?",正确写法如下:
// //与下面的方法等价 // var imgsDic = dict["images"] as! NSDictionary // model.movImg = imgsDic["large"] as? String model.movImg = (dict["images"] as! NSDictionary)["large"] as? String (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |