gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-11-29 11:31:37 24 4
gpt4 key购买 nike

我在 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/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com