Swift 2 – Can't get user location with CLLocationManager

前端 未结 3 954
难免孤独
难免孤独 2020-12-11 22:29

Here is my VC code:

import UIKit
import MapKit
import CoreLocation

class ViewController: UIViewController, MKMapViewDelegate, CLLocationMan         


        
3条回答
  •  甜味超标
    2020-12-11 23:13

    you have to use these location access permission in your plist.

    1. NSLocationAlwaysAndWhenInUseUsageDescription
    2. NSLocationWhenInUseUsageDescription

    you are not using always and in InUse permiossion

    Note by Apple:

    This app has attempted to access privacy-sensitive data without a usage description. The app's Info.plist must contain both NSLocationAlwaysAndWhenInUseUsageDescription and NSLocationWhenInUseUsageDescription keys with string values explaining to the user how the app uses this data

提交回复
热议问题