由于关闭,我刚从parse迁移到kinvey,我想知道是否有人可以帮助我弄清楚kinvey SDK的查询是什么样子的。这里是:
let innerP1 = NSPredicate(format: "sender = %@ AND other = %@", userName, otherName)
let innerQ1:PFQuery = PFQuery(className: "Messages", predicate: innerP1)
let innerP2 = NSPredicate(format: "sender = %@ AND other = %@", otherName, userName)
let innerQ2:PFQuery = PFQuery(className: "Messages", predicate: innerP2)
let query = PFQuery.orQueryWithSubqueries([innerQ1,innerQ2])
query.addAscendingOrder("createdAt")
query.findObjectsInBackgroundWithBlock {
(objects:[PFObject]?, error:NSError?) -> Void in //UPDATE THIS
}
最佳答案
作为一个广泛的例子。。。
http://devcenter.kinvey.com/phonegap/reference/api/Kinvey.Query.html
var query = new Kinvey.Query();
var query2 = new Kinvey.Query();
query.equalTo("sender",userName).and().equalTo("other",other name);
query2.equalTo("sender",otherName).and().equalTo("other",userName);
query.or(query2);
query.ascending("_kml.lmt"); //last modified time
var promise = Kinvey. DataStore.Find("group name",query);
promise.then(successfunction,fail function);
另外,请注意这是一个使用phonegap库的示例,请参阅kinvey的Android或iOS参考资料。
关于swift - 解析到Kinvey查询,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/35737435/