简体   繁体   中英

Xcode: My user location doesn't show the first time I run the simulation but the second time it does

Whenever I first open up the project and hit build and run the first time the app won't focus on the current user location. But if I stop the simulation and build it again and run it, it will then focus on the user location like I want it to. I can't figure out why it does this, is it something wrong with the simulator or is something wrong with my code?

super viewDidLoad];
self.mapview.showsUserLocation = YES;
self.mapview.delegate = self;
[self.mapview setUserTrackingMode:MKUserTrackingModeFollow animated:YES];

Did you try Debug->Location Service ? try this

For now move self.mapview.showsUserLocation = YES; to the last line. This could do what you expect.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM