gpt4 book ai didi

ios - 定位服务不会在 iPad 上激活

转载 作者:塔克拉玛干 更新时间:2023-11-02 07:52:31 24 4
gpt4 key购买 nike

我正在开发一个使用定位服务的 iOS 应用程序。该应用程序在 iPhone(3GS 和 4)上运行良好,但在 iPad 上运行时不请求位置服务。也就是说,永远不会要求用户启用定位服务,该应用也不会出现在“设置”应用的“定位服务”部分。

我看到一些论坛帖子描述了类似的问题,但所有这些问题都通过 iTunes(通过临时分发)在 iPad 上安装应用程序而不是通过 Xcode 运行它,或者通过重置位置警告来解决。我在 iPad、iPad 2 和 iPad 模拟器上尝试了这两种解决方案,均无济于事。

我们使用以下代码启用位置服务更新。我们已通过设备上调试和放置 NSLog 来验证我们的代码正在运行。

- (id)init {
[super init];

if (clManager == nil) {
clManager = [[CLLocationManager alloc] init];
}
clManager.delegate = self;

[self startLocationMonitoring];

return self;
}

- (BOOL)isLocationAvailable {
return [CLLocationManager significantLocationChangeMonitoringAvailable];
}

- (void)startLocationMonitoring {
if ([self isLocationAvailable]) {
[clManager startMonitoringSignificantLocationChanges];
} else {
// handle lack of Location Services
}
}

最佳答案

这可能无法回答您的问题,但可能会对某些人有所帮助。 WiFi iPad 型号不支持重大位置更改(significantLocationChangeMonitoringAvailable 方法返回 NO)并且 startMonitoringSignificantLocationChanges 在这些型号上运行时似乎什么都不做– 它不会触发错误委托(delegate)方法,也不会提出请求位置服务许可的蓝色气泡对话框。

关于ios - 定位服务不会在 iPad 上激活,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5524740/

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