我正在做一个查询,我正在检查,看是否指针,“列”列中的值是否等于一个字符串,newLogObjectId。我显然不能这样做,因为指针和字符串是不同的值类型,(返回nil)。当我查看Parse中的数据时,我注意到在Parent列中列出了objectId,但在一个按钮中,单击该按钮时将加载NewLog类。
如何更改“Parent”是代码“query1.whereKey(”Parent“,equalTo:newLogObjectId)”中的指针中的objectId?像“Parent.objectId”解析查询返回零
//ObjectId of row of Marker Selected, a string, for example, "MCeKMyxRIt"
let newLogObjectId = objectIdArray[markerIndex]
//Query ComparablePhotos class
let query1 = PFQuery(className: "ComparablePhotos")
//Grab all rows of Parent, equal to newLogObjectId ex: "MCeKMyxRIt"
//Issue: "Parent" is a pointer, not a String. Parent has an objectId
query1.whereKey("Parent", equalTo:newLogObjectId)
//Get result as an object
viewRecordObject = query1.findObjects() as! [PFObject]
is query1.whereKey(“Parent”,equalTo:newLog.ObjectId)not working?通常你通过.objectId,.username等等来访问用户名,objectId或你的对象所在的列。或者... query1.Parent.query.findobjectsInBackgroundwithBlock { –
我会查询NewLog类'whereKey(“objectId”, containedIn:objectIdArray)'获取所有PFObject与关联的对象ID。让这个查询获取Parent字段,然后遍历您的对象以获取每个Parent。 – Connor
没有史蒂夫,它不工作。我相信如果它是Android,它会以这种方式工作。 –