0
我的查詢應該搜索解析類並返回所有PFObjects,如果它們包含標記數組中的字符串的話。沒有whereKey: equalTo:
代碼工作,所有對象都顯示出來,但沒有任何顯示。解析whereKey:equalTo:不起作用
import Foundation
class WallPost: PFObject, PFSubclassing {
@NSManaged var post: String
@NSManaged var user: PFUser
@NSManaged var tags: [String]
init(post: String, user: PFUser, tags: [String]) {
super.init()
self.post = post
self.user = user
self.tags = tags
}
override init() {
super.init()
}
override class func query() -> PFQuery?{
let query = PFQuery(className: parseClassName())
query.includeKey("user")
query.whereKey("tags", equalTo: "rock")
query.orderByDescending("createdAt")
return query
}
class func parseClassName() -> String {
return "POST"
}
override class func initialize(){
var onceToken: dispatch_once_t = 0
dispatch_once(&onceToken) {
self.registerSubclass()
}
}
}
this is what the parse class looks like
當我使用'containedIn'時,我仍然沒有得到任何東西。 – Michi314
用query.whereKey(「tags」,containedIn:[「rock」])取代你的equalTo仍然沒有給你什麼?奇怪的。我會繼續尋找。 – MQLN
是的,這真的很奇怪。謝謝 – Michi314