【发布时间】:2016-12-27 22:13:51
【问题描述】:
我目前正在使用最新的 Kinvey SDK(版本 3.3.5)将 swift 2.3 迁移到 3。自 1x 版本以来,他们进行了大量更新。我的问题是有没有人能够成功地查询 PersistableKeyID 字段并提取多个对象?
我曾经能够使用“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'
既然“loadObjects”已被贬值,任何人都知道如何执行此操作?我找不到提供的“find(byIds)”。
【问题讨论】: