swift上的解析关系查询错误

时间:2015-12-30 15:22:33

标签: swift parse-platform

我在parse.com上有2个表。我想建立友谊体系。

first table User -> username, email ...
Friendship Table -> RequestFrom(Related User Table), RequestTo(Related User Table), status

我使用这段代码:

    let usr = PFObject(className: "User")
    let friend = PFObject(className: "Friends")
    var relation = friend.relationForKey("RequestFrom")
    relation.addObject(PFUser.object())
    relation.query().findObjectsInBackgroundWithBlock { (objects , error ) -> Void in
        for obje in objects! {
            print(obje)
        }
    }

此代码错误。

"NSInternalInconsistencyException" with reason "Tried to save an object with a new, unsaved child.":

这是朋友表 https://www.dropbox.com/s/ywfpl7di4i767o7/Screenshot%202015-12-31%2014.09.40.png?dl=0 用户表是经典的解析用户类。 我该如何解决这个问题?

0 个答案:

没有答案