我正在做一個查詢,我正在檢查,看是否指針,「列」列中的值是否等於一個字符串,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,它會以這種方式工作。 –