我正在尝试搜索字典匹配结果但没有运气
我的解析字典列看起来像这样
columnName:标签属性:对象
{“firstKey”:”大卫”,” secondKey”:”圭塔”}
columnName:name属性:string
凉爽 
当我尝试搜索名称列
时这是我的代码段,
static func parseQueryDictionary() {
let query = PFQuery(className:"TestDictionary")
query.whereKey("name", equalTo: "cool")
query.findObjectsInBackgroundWithBlock {
(objects: [PFObject]?, error: NSError?) -> Void in
if error == nil && objects != nil {
print("objects is", objects)
} else {
print(error)
}
}
}
我得到的结果
对象是可选的([{ 标签= { firstKey =大卫; secondKey = Guetta; }; name = cool; tagArray =( 大卫, 圭塔 ); }])
我尝试过阵列 columnName:tagArray属性:array [ “大卫”, “圭塔”]
static func parseQueryDictionary() {
let query = PFQuery(className:"TestDictionary")
query.whereKey("tagArray", equalTo:"David")
query.findObjectsInBackgroundWithBlock {
(objects: [PFObject]?, error: NSError?) -> Void in
if error == nil && objects != nil {
print("objects is", objects)
} else {
print(error)
}
}
}
我得到结果
对象是可选的([{ 标签= { firstKey =大卫; secondKey = Guetta; }; name = cool; tagArray =( 大卫, 圭塔 ); }])
但是当我尝试搜索字典列时
columnName:标签属性:对象 {“firstKey”:”大卫”,” secondKey”:”圭塔”}
像这样static func parseQueryDictionary() {
let query = PFQuery(className:"TestDictionary")
query.whereKey("Tag", equalTo:"David")
query.findObjectsInBackgroundWithBlock {
(objects: [PFObject]?, error: NSError?) -> Void in
if error == nil && objects != nil {
print("objects is", objects)
} else {
print(error)
}
}
}
我没有结果
对象是可选的([])

我试过谷歌并解析官方文档,但找不到这种情况,是否可以这样做?
我尝试搜索字符串列,数组列它的工作但只有字典列不起作用...
答案 0 :(得分:0)
在谷歌搜索" findObjectsInBackgroundWithBlock"在swift.It会给你很多结果。
var query = PFQuery(className: parseClassName)
query.whereKey("Position", equalTo: "iOS Developer")//Here Position is column name and Sales Manager is value.
query.findObjectsInBackgroundWithBlock ({(objects:[AnyObject]!, error: NSError!) in
if(error == nil){
for object in objects {
}
}
else{
println("Error in retrieving \(error)")
}
})