Hashem Aboonajmi Hashem Aboonajmi -4 years ago 92
Swift Question

Parse: can't assign relationship with subclasses

Here it is: I have defined subclass of

PFUser
named
User


class User: PFUser {

@NSManaged var name: String?
@NSManaged var qrCode: QRCode?
}


and a subclass of
PFObject
named
QRCode
:

class HQRCode: PFObject {

@NSManaged var code: String

convenience init(_ code: String) {

self.init()
setObject(code, forKey: "code")
}
}


and I have registered subclassed in
AppDelegate
:

QRCode.registerSubclass()
User.registerSubclass()


when I retrieve a QRcode from the server and assign it to the user, but unfortunately I got the following error:

// retrieve and assign qrcode
newUser.qrCode = QRcode



Error Domain=Parse Code=111 "schema mismatch for _User.qrCode; expected Relation but got Pointer"


What does it mean? and How can I solve it?

Answer Source

That error was issuing the qrCode column in User class on the "Dashboard" is of type Relationship. to fix it I set that to type Pointer

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download