objective c - Cannot get the my location dot for Google Maps iOS SDK -


currently, not able location in app developing.

basically, in documentation google maps ios sdk, google mentions can:

enable blue "my location" dot , compass direction setting mylocationenabled on gmsmapview https://developers.google.com/maps/documentation/ios/map#my_location

however, when that, dot not appear in view.

here's setup, have view controller contains view. view contains 3 things, 2 buttons , map view:

enter image description here

i have linked mapview gmsmapview , can see map without problems.

now, want, located.

i tried 2 things. first, using custom, draft button (the information), tried manually set location mapview wasn't working though locationservicesenabled method returned yes.

then, tried using googlemaps's dot isn't working either.

here's code:

studydisplayviewcontroller.h:

#import <uikit/uikit.h> #import <corelocation/corelocation.h> #import "googlemaps/googlemaps.h"   @interface studydisplayviewcontroller : uiviewcontroller <cllocationmanagerdelegate> {  }  @property (strong, readwrite) cllocationmanager *locationmanager; @property (weak, nonatomic) iboutlet gmsmapview *mapview;  @end 

studydisplayviewcontroller.m

#import "studydisplayviewcontroller.h"  @interface studydisplayviewcontroller () - (ibaction)closestudydisplay:(id)sender; - (ibaction)locateme:(id)sender;  @end  @implementation studydisplayviewcontroller  - (void)viewdidload {     [super viewdidload];     // additional setup after loading view.     self.locationmanager = [[cllocationmanager alloc] init];     self.locationmanager.delegate = self;     self.locationmanager.distancefilter = kcldistancefilternone;     self.locationmanager.desiredaccuracy = kcllocationaccuracybest;      if([cllocationmanager authorizationstatus] == kclauthorizationstatusnotdetermined) {         nslog(@"starting location service");         [self.locationmanager requestwheninuseauthorization];         [self.locationmanager startmonitoringsignificantlocationchanges];         if([cllocationmanager locationservicesenabled]) {             nslog(@"all good");         }         else {             nslog(@"damn son");         }     }      self.mapview.settings.compassbutton = yes;             self.mapview.mylocationenabled = yes;     }  - (void)didreceivememorywarning {     [super didreceivememorywarning];     // dispose of resources can recreated. }  - (void) locationmanager:(cllocationmanager *)manager didchangeauthorizationstatus:(clauthorizationstatus)status {  }  -(void) locationmanager:(cllocationmanager *)manager didupdatelocations:(nsarray *)locations {     nslog(@"getting location"); }   /* #pragma mark - navigation  // in storyboard-based application, want little preparation before navigation - (void)prepareforsegue:(uistoryboardsegue *)segue sender:(id)sender {     // new view controller using [segue destinationviewcontroller].     // pass selected object new view controller. } */  - (ibaction)closestudydisplay:(id)sender {     [self dismissviewcontrolleranimated:yes completion:nil]; }  - (ibaction)locateme:(id)sender {      nslog(@"user's location: %@", self.mapview.mylocation);  } 

i using xcode 6.3.2 , ios 8.3.

first check out following things there or not.

    locationmanager = [[cllocationmanager alloc]init];     locationmanager.delegate= self;     if([locationmanager respondstoselector:@selector(requestwheninuseauthorization)]){         [locationmanager requestwheninuseauthorization];     }     [locationmanager startupdatinglocation];      _mapview.mylocationenabled =  yes;     _mapview.settings.mylocationbutton =  yes; 

if there , if testing on simulator try change location in simulator debug tab, e.g. change free car run of of them.

also, check if have added description in plist nslocationwheninuseusagedescription.


Comments

Popular posts from this blog

PHP DOM loadHTML() method unusual warning -

python - How to create jsonb index using GIN on SQLAlchemy? -

c# - TransactionScope not rolling back although no complete() is called -