Fatal error: Dictionary literal contains duplicate keys
如何删除错误?
let people = ["age":14,"age":15,"age":75,"age":43,"age":103,"age":87,"age":12]for (key,value) in people { print(value)}解决方法 每个字典键必须是唯一的
let people = ["age1":14,"age2":15,"age3":75,"age4":43,"age5":103,"age6":87,"age7":12]for (key,value) in people { print(value)}总结
以上是内存溢出为你收集整理的迭代字典时如何避免swift中的重复键错误全部内容,希望文章能够帮你解决迭代字典时如何避免swift中的重复键错误所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)