tvos Location Services prompt never prompted

假如想象 提交于 2019-12-13 07:24:34

问题


Have anyone gotten CLLocationManager to prompt for permission on tvos? I'm using the following code (that works on other platforms) to get a user's location and prompt for permissions.

self.locationManager = [[CLLocationManager alloc] init];
self.locationManager.desiredAccuracy = kCLLocationAccuracyThreeKilometers;
self.locationManager.delegate = self;
[self.locationManager requestWhenInUseAuthorization];
[self.locationManager requestLocation];

However, the authorization delegate is called with a status of kCLAuthorizationStatusNotDetermined.

If I go into Settings > Privacy > Location Services > App Name, I can manually change permission and then getting a user's location works. However, I'm unable to prompt the user within the app. Has anyone else gotten this to work?


回答1:


It turns out my info.plist needed CFBundleDisplayName in order to show the location services prompt. Adding this enabled the ability to prompt the user.




回答2:


add to plist these rows with type bool and value YES

  • NSLocationAlwaysUsageDescription
  • NSLocationWhenInUseUsageDescription

then delete your app an if you using simulator go to debug tap then set test location

thats worked for me



来源:https://stackoverflow.com/questions/33724837/tvos-location-services-prompt-never-prompted

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!