ios - 位置访问权限警报未显示且 CLLocation 管理器委托(delegate)方法未在 xcode 6.4 中调用。请指教

标签 ios core-location cllocationmanager

我在 Objective C 类中完成了 CLLocationmager。在这里,我的代码是,

CLLocationManager *loc = [[CLLocationManager alloc]init];
[loc setDelegate:self];
[loc requestWhenInUseAuthorization];
[loc requestAlwaysAuthorization];
loc.desiredAccuracy = kCLLocationAccuracyBest; 
loc.distanceFilter = kCLHeadingFilterNone;
[loc startUpdatingLocation];
[loc startUpdatingHeading];

然后在.plist 文件中添加了隐私设置。 仍然没有得到任何回应。

最佳答案

https://developer.apple.com/documentation/corelocation/cllocationmanager?language=objc

  1. Create an instance of the CLLocationManager class and store a strong reference to it somewhere in your app.

    Keeping a strong reference to the location manager object is required until all tasks involving that object are complete. Because most location manager tasks run asynchronously, storing your location manager in a local variable is insufficient.

关于ios - 位置访问权限警报未显示且 CLLocation 管理器委托(delegate)方法未在 xcode 6.4 中调用。请指教,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52981313/

相关文章:

iphone - 将 GPS 集成到我的应用程序中

ios - 在不耗尽电池电量的情况下以良好的准确性获取位置更新的最佳方法

iOS 和 Swift : CLLocationManagerDelegate not updating location coordinates beyond the first location

ios - 你能在 iOS 5 中将 PNG 保存到照片库吗?

ios - 检查当前是否使用定位服务

ios - 应用程序 :openURL:sourceApplication:annotation: not found in iOS 8 的实现

带有 CoreLocation 的 iOS 地理围栏

iphone - 检查用户是否允许应用程序使用他们的位置

ios - 标题为 NSPredicate 的 EKEventStore 搜索事件

ios - 使用 Alamofire.upload 时出现段错误 : 11,