0
array = [
“test” = test
“test1” = test
“test2” = test
“test4” = test
]
检查TEST3是阵列中斯威夫特:检查空数组
我试着这样做:
if let check= userObject[“test3”]{
}
我的应用程序崩溃,我得到这个错误:意外发现零而展开的可选值
array = [
“test” = test
“test1” = test
“test2” = test
“test4” = test
]
检查TEST3是阵列中斯威夫特:检查空数组
我试着这样做:
if let check= userObject[“test3”]{
}
我的应用程序崩溃,我得到这个错误:意外发现零而展开的可选值
您需要用逗号分隔对象,这是一个字典,而不是数组。
var dict: [String: AnyObject] = [:]
dict = [
"test": test,
"test1": test,
"test2": test,
"test4": test
]
是不是你的数组声明错误? – sasquatch