我目前正在使用最新的Kinvey SDK(版本3.3.5)將swift 2.3遷移到3的過程。自從1x版本以來,他們已經做了大量更新。我的問題是任何人都能夠成功地查詢PersistableKeyID字段並拉多個對象?Kinvey 3.3.5 SDK查詢Ids
我使用能夠使用「loadObjects」函數將一個字符串數組作爲參數。此函數已被折舊並被find(byId)取代。見下:
dataStore.find(byId: "only takes one") { uClass, error in
if let uClass = uClass {
//succeed
print("UClass: \(uClass)")
} else {
//fail
}
問題是,它只會把一個字符串作爲參數。我試圖使用查詢功能,但我無法讓它將「_id」字段作爲參數。使用下面的代碼:
//Just statically creating the sectionID array for now. This will dynamically be created
testIDs = ["58668307206c11177e5ab0d4", "58668307206c11177e5ab0d4", "57ad00a505a2bb55632659c3"]
let sectionStore = DataStore<Section>.collection()
let sectionQuery = Query(format: "_id IN %@", testIDs)
sectionStore.find(sectionQuery) {sectionResult, error in
if let sectionResult = sectionResult {
self.sectionsTest = sectionResult
self.sectionCollectionView.reloadData()
} else{
//Error
}
}
我收到的錯誤:
'Invalid property name', reason: 'Property '_id' not found in object of type 'Section'
人對如何現在「裝入對象」現在已經貶值來執行這一點的想法?沒有交付「find(byIds)」,我可以找到。
我仍然收到了同樣的錯誤: 「無效的屬性名稱」,理由是:「財產‘_id’不是類型的對象中找到...' 我從後端收集的數據集合,它確實有一個「_id」屬性。我不知道爲什麼這不起作用。 – jbone107
我已更新原始帖子,顯示使用Pranav的答案的嘗試。問題是「_id」參數無法識別。 – jbone107
James, 我能夠重現該問題,並已升級爲工程。一旦我有更多的工程信息,我會盡快回復您。 謝謝, Pranav Kinvey MLIBZ-1613 –