问题描述
有没有人得到CLLocationManager来提示对tvos的许可?我正在使用以下代码(在其他平台上也可以使用)来获取用户的位置并提示输入权限.
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];
但是,以状态kCLAuthorizationStatusNotDetermined
调用授权委托.
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?
推荐答案
原来,我的info.plist需要CFBundleDisplayName
才能显示位置服务提示.添加此功能可以提示用户.
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.
这篇关于tvos定位服务提示从未提示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!