以下是实体的定义:
class Event : PFObject, PFSubclassing {
override class func load() {
superclass()?.load()
self.registerSubclass()
}
class func parseClassName() -> String! {
return "Event"
}
}
˚ 现在我正在尝试检索属于Event的团队列表:
var teams: [Team] = []
var query = PFQuery(className: "Team")
query.includeKey("event")
if (event != nil) {
query.whereKey("event", equalTo: event)
}
query.cachePolicy = kPFCachePolicyCacheThenNetwork
query.findObjectsInBackgroundWithBlock { (objects: [AnyObject]!, error:NSError!) -> Void in
我收到错误,
[错误]:捕获“NSInternalInconsistencyException”,原因是“尝试使用未保存的新子项保存对象。”:
但是如果我删除了whereKey语句:query.whereKey(“event”,equalTo:event),则错误消失。
任何帮助都将不胜感激。