Location Services not working in iOS 8

前端 未结 26 1982
滥情空心
滥情空心 2020-11-21 10:23

My app that worked fine on iOS 7 doesn\'t work with the iOS 8 SDK.

CLLocationManager doesn\'t return a location, and I don\'t see my app under

26条回答
  •  盖世英雄少女心
    2020-11-21 10:41

    Before [locationManager startUpdatingLocation];, add an iOS8 location services request:

    if([locationManager respondsToSelector:@selector(requestAlwaysAuthorization)])
        [locationManager requestAlwaysAuthorization];
    

    Edit your app's Info.plist and add key NSLocationAlwaysUsageDescription with the string value that will be displayed to the user (for example, We do our best to preserve your battery life.)

    If your app needs location services only while the app is open, replace:

    requestAlwaysAuthorization with requestWhenInUseAuthorization and

    NSLocationAlwaysUsageDescription with NSLocationWhenInUseUsageDescription.

提交回复
热议问题