本文介绍了一个键上的两个查询约束与解析和Swift的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
guys,我试图获取所有的用户名不包括在数组中的PFUsers(
Every user shows. It peforms both these queries, and adds them together. I want to constrain the first p>这是一种方式
println(geoPoint) user["location"] = geoPoint let rejectedUsers: [String] = user["rejected"].copy() as [String] let acceptedUsers: [String] = user["accepted"].copy() as [String] let ignoredUsers = rejectedUsers + acceptedUsers var query = PFUser.query() query.whereKey("location", nearGeoPoint: geoPoint) query.whereKey("username", notEqualTo: user.username) query.whereKey("gender", equalTo: user["interestedIn"]) query.whereKey("username", notContainedIn: ignoredUsers) query.limit = 10 query.findObjectsInBackgroundWithBlock({ (objects: [AnyObject]!, error2: NSError!) -> Void in if error2 != nil { println(error2) } else { if objects.isEmpty { println("empty query") } else { for object in objects { self.usernames.append(object.username) self.userImages.append(object["image"] as NSData)
注意我是如何从parse
复制我的用户[rejected创建ignoredUsers
notice how i had to copy my user["rejected"] array from parsethen i used + to create "ignoredUsers"
然后我可以使用:
query.whereKey(username,notContainedIn :ignoredUsers)
query.whereKey("username", notContainedIn: ignoredUsers)
这篇关于一个键上的两个查询约束与解析和Swift的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!