簡體   English   中英

Xcode:我的用戶位置在第一次運行模擬時沒有顯示,但是在第二次運行時顯示

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

每當我第一次打開項目並單擊“構建並運行”時,應用程序將不會專注於當前用戶位置。 但是,如果我停止仿真並再次構建它並運行它,它將像我希望的那樣將焦點放在用戶位置上。 我不知道為什么這樣做,模擬器有問題還是我的代碼有問題?

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

您是否嘗試了Debug-> Location Service? 嘗試這個

現在移動self.mapview.showsUserLocation = YES; 到最后一行。 這可以達到您的期望。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM