开发者

iOS, CoreLocation - Get users location when the app loads

开发者 https://www.devze.com 2023-03-20 15:06 出处:网络
I am trying to get my app to get the longitude and latitude of the users current positio开发者_如何学运维n as soon as they load up the app. From here I can tell if they are a certain distance from a p

I am trying to get my app to get the longitude and latitude of the users current positio开发者_如何学运维n as soon as they load up the app. From here I can tell if they are a certain distance from a point, and call different functions based on this.

I can get it to work fine from viewDidLoad, but I don't want it to keep performing this every time said view is loaded. How would I (if possible) call this from the app delegates didFinishLaunchingWithOptions method?


I think you're looking for CLLocationManager, which is the GPS implementation. It has no UI and runs in the background, but you don't invoke it from the PList, you implement a class. Find the "LocateMe" example project for the code.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号