ios - Getting Current Location using Parse SDK -
i'm trying current location of user using build in geopointforcurrentlocation method. try set geopoint in custom field created in user class called location , attempt save using saveinbackground method.
[pfgeopoint geopointforcurrentlocationinbackground: ^(pfgeopoint *geopoint, nserror *error) { if (!error) { [[pfuser currentuser] setobject: geopoint forkey: @"location"]; [[pfuser currentuser] saveinbackground]; } }];
no errors thrown user's location not saved database.
edit:
my viewdidload method looks this:
self.locationmanager = [[cllocationmanager alloc] init]; self.locationmanager.delegate = self;
if ([self.locationmanager respondstoselector:@selector(requestwheninuseauthorization)]) { [self.locationmanager requestwheninuseauthorization]; }
}
and set info.plist key when in use authorization.
did not mark implementation file cllocationmanagerdelegate.
Comments
Post a Comment