How to get Location (latitude & longitude value) in variable on iOS?

后端 未结 3 1851
南旧
南旧 2020-12-15 07:41

I would like to use the location of my app user, more specifically the latitude and longitude value.

I need them to use in a variable, so that I can send them with

3条回答
  •  Happy的楠姐
    2020-12-15 08:16

    Swift:

    var locationManager = CLLocationManager()
    locationManager.distanceFilter = kCLDistanceFilterNone
    locationManager.desiredAccuracy = kCLLocationAccuracyHundredMeters
    locationManager.startUpdatingLocation()
    

    More info here: https://developer.apple.com/library/mac/documentation/CoreLocation/Reference/CLLocationManager_Class/index.html#//apple_ref/occ/cl/CLLocationManager

提交回复
热议问题