ios - Subclassing PFUser does not effect the data stored -
i using swift.
this question talks parse service.
i've read ways using both @nsmanaged
, dynamic
key-words, decided example implement them both. issue here in user
object of data manager, i'm noticing additional information not being stored in database. application store additional information in user table, such first , last name. here's example:
import parse public class user : pfuser { @nsmanaged public var firstname: string! dynamic public var lastname: string! override public class func initialize() { struct static { static var oncetoken : dispatch_once_t = 0 } dispatch_once(&static.oncetoken) { self.registersubclass() } } init(email: string, password: string) { super.init(); self.username = email; self.email = email; self.password = password; self.firstname = "myfirstname"; self.lastname = "mylastname"; } }
here's code i'm using initialize , send off data:
@ibaction func register() { let newuser = user(email: "myemail@provider.com", password: "my password"); newuser.signupinbackgroundwithblock { (success, error) -> void in if error == nil { print("success") } else { print(error); } } }
edit: upon playing around in dashboard seems fields added user table / document / whatever want call in schema less database automatically removed. indicate need create class (ie: userinfo) store of users information, such first , last name. correct? if seems little odd, increase amount of requests login application. (one validation, 1 retrieving information). correct way of handling this?
adding properties subclass won't them automatically added pfuser
instance. have use pfobject
methods set properties , save pfuser
object.
the parse documentation gives example of setting phone
property on pfuser
instance before calling signup. how can add firstname
, lastname
properties pfuser
.
Comments
Post a Comment