如何解决WatchOS 上 Xamarin 中的 RequestWhenInUseAuthorization 未显示任何授权请求
我正在尝试在 Xamarin 的 WatchOS 应用上使用定位服务。我的 InterfaceController.Awake() 方法中有以下代码
_locationManager = new CLLocationManager();
_locationManager.Delegate = new MyLocationDelegate(LatitudeLabel,LongitudeLabel);
_locationManager.DesiredAccuracy = CLLocation.AccuracyBest;
_locationManager.RequestWhenInUseAuthorization();
_locationManager.StartUpdatingLocation();
LocationDelegate 具有以下 AuthorizationChanged 实现:
public override void AuthorizationChanged(CLLocationManager manager,CLAuthorizationStatus status)
{
Console.WriteLine("Location authorization changed: {0}",status);
}
在 WatchOS 模拟器中运行应用程序时,我得到以下输出:
2020-12-28 12:51:42.519358+0100 watchgpsWatchOSExtension[8630:441021] Location authorization changed: NotDetermined
我的所有 Info.plist(WatchOS 应用/扩展和 iOS 配套应用)中都有以下键/值:
<key>NSLocationWhenInUseUsageDescription</key>
<string>To get locations</string>
根据这个问题:
Request location on the Apple Watch only,without code on the paired phone
我应该在模拟 iPhone 上收到授权请求,但没有任何反应。
知道我在这里做错了什么吗?
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。