Ios 是否需要compass应用程序从用户获取位置权限

Ios 是否需要compass应用程序从用户获取位置权限,ios,cllocationmanager,Ios,Cllocationmanager,我的应用程序具有指南针功能。为了得到我们用过的航向 func locationManager(CLLocationManager, didUpdateHeading: CLHeading) 方法。 我需要从用户处获取位置权限吗?试试这个 func requestLocationPermission() { let manager = CLLocationManager() manager.delegate = self manager.startUpdatingHea

我的应用程序具有指南针功能。为了得到我们用过的航向

func locationManager(CLLocationManager, didUpdateHeading: CLHeading)
方法。 我需要从用户处获取位置权限吗?

试试这个

func requestLocationPermission() {
    let manager = CLLocationManager()

    manager.delegate = self
    manager.startUpdatingHeading()
    // Store manager variable
}
实施

func locationManager(_ manager: CLLocationManager, didUpdateHeading newHeading: CLHeading)

更新:您可以在没有位置许可的情况下观察更新标题。

谢谢回复。我已经在info.plist中添加了密钥并请求许可。我的困惑是,。我们可以在没有权限的情况下使用上述标题方法吗?@SangramShivankar是的,您可以在没有权限的情况下获取更新标题。