ios - Parse to Heroku migration (MongoLab): PFRelation issue -
i succeeded migrate parse parse-server mongolab. works expected, except when i'm logging pfuser mongolab, pfrelation object null.
in appdelegate, when run code (official parse):
[parse setapplicationid:@"xxxxxx" clientkey:@"xxxxxx"]; [pfuser enablerevocablesessioninbackground];
homeview.m:
self.currentuser = [pfuser currentuser]; self.friendsrelation = [[pfuser currentuser] objectforkey:@"friends"]; nslog(@"%@", self.currentuser); nslog(@"%@", self.friendsrelation);
after login, homeview log this:
2016-02-28 23:25:38.756 chilln[4131:57119] <pfuser: 0x7fe0b3e4fc10, objectid: mzdphaqbyr, localid: (null)> { friends = "<pfrelation: 0x7fe0b3e4f900, 0x7fe0b3e4fc10.friends -> _user>"; phone = "06 19 05 39 30"; surname = a; username = a; } 2016-02-28 23:25:38.756 chilln[4131:57119] <pfrelation: 0x7fe0b3e4f900, 0x7fe0b3e4fc10.friends -> _user>
so everything's right.
now mongolab db:
appdelegate:
[parse initializewithconfiguration:[parseclientconfiguration configurationwithblock:^(id<parsemutableclientconfiguration> configuration) { configuration.applicationid = @"xxxxxxx"; configuration.clientkey = @"xxxxxxx"; configuration.server = @"http://xxxxxxx.herokuapp.com/parse/"; }]];
after login, homeview log this:
2016-02-28 23:29:21.785 chilln[4281:59046] <pfuser: 0x7fa43c09ed20, objectid: mzdphaqbyr, localid: (null)> { phone = "06 19 05 39 27"; surname = a; username = a; } 2016-02-28 23:29:21.786 chilln[4281:59046] (null)
for logging, i'm using:
[pfuser loginwithusernameinbackground:user password:password block:^(pfuser *user, nserror *error) {}];
here record user mongolab:
{ "_id": "mzdphaqbyr", "_perishable_token": "shuhtwl0eoxxmnlokspmp1vbf", "username": "a", "phone": "06 19 05 39 27", "surname": "a", "_session_token": "zo2drjzro0to1q0jiohal8f4v", "_hashed_password": "$2a$10$a7j5yb7ufdtv.ynhesvjgo9io.nci8hbx7vngoo.fyza3qblxw38g", "_created_at": { "$date": "2016-02-28t21:55:48.548z" }, "_updated_at": { "$date": "2016-02-28t22:03:45.704z" } }
it mistake in code, had replace:
self.friendsrelation = [[pfuser currentuser] objectforkey:@"friends"];
to
self.friendsrelation = [[pfuser currentuser] relationforkey:@"friends"];
hope one. cheers!
Comments
Post a Comment