简体   繁体   English

Xcode:我的用户位置在第一次运行模拟时没有显示,但是在第二次运行时显示

[英]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 ? 您是否尝试了Debug-> Location Service? try this 尝试这个

For now move self.mapview.showsUserLocation = YES; 现在移动self.mapview.showsUserLocation = YES; to the last line. 到最后一行。 This could do what you expect. 这可以达到您的期望。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Xcode应用程序在我第一次运行时不会在ipod上启动,但会第二次运行(没有清理/构建) - Xcode app won't launch on ipod the first time I run, but will run the second time (no clean/build) WkWebView 消息处理程序第一次不返回文本框的值,但它在我第二次按下按钮时返回 - WkWebView Message handler doesn't return the value of textbox first time, but it does the second time I press the button Xcode 6 / iOS 8位置模拟不起作用 - Xcode 6/iOS 8 Location Simulation doesn't work 为什么我的标签没有显示我的计时器时间? - why does my label doesn't show my timer time? TableViewCell不在第一次显示数据 - TableViewCell doesn't show data on first time 我准备第二次打开应用程序时,PhoneGap设备就绪不会触发,xcode部署 - PhoneGap device ready doesn't fire the second time I open the app, xcode deployment 有可能知道我的应用程序是第一次运行或不在xcode? - is that possible to know my apps is first time run or not in xcode? UIBarButtonItem设计更改第一次无效,但第二次无效 - UIBarButtonItem design change doesn't work the first time but the second 首次启动后,启动屏幕没有出现吗? - Launch screen doesn't show first after the first launch time? 为什么第二次按下视图时后退按钮不显示? - Why doesn't the back button show up the second time I push the view?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM