在 iPod Touch 上的应用程序内部以编程方式启用位置服务
我有一个使用 GPS 进行定位服务的 iOS 应用程序。用户希望在带有外部 GPS 的 iPod Touch 上使用该应用程序,但问题是用户无法在该应用程序的“设置”->“常规设置”->“位置服务”中启用“位置服务”。
当应用程序在 iPhone 上运行时,在“设置”->“常规设置”->“位置服务”中,该应用程序会显示一个切换开关,用于启用/禁用该应用程序的位置服务。但是,当该应用程序在 iPod Touch 上运行时,该应用程序不会显示在“设置”->“常规设置”->“位置服务”中。
有谁知道我需要以编程方式执行什么操作,才能使该应用程序的位置服务在 iPod Touch 上运行时在“设置”->“常规设置”->“位置服务”中通过切换开关显示?
I have an iOS application that uses GPS for Location Services. A user would like to use the app on an iPod Touch with an external GPS, but the problem is that the user can't enable Location Services in Settings->General Settings->Location Services for this app.
When the app is run on an iPhone, in Settings->General Settings->Location Services, the app shows up with a toggle switch to enable/disable Location Services for this app. But when the app is run on an iPod Touch, the app doesn't show up in Settings->General Settings->Location Services.
Does anyone know what I need to do programmatically to cause Location Services for this app to show up with a toggle switch in Settings->General Settings->Location Services when run on an iPod Touch?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
发布评论
评论(2)
我明白问题出在哪里了。我有以下代码,仅允许 iPhone 定位服务,而不允许 iPod。哎呀!
if([model hasPrefix:@"iPhone"]){
self.locationManager = [[CLLocationManager alloc] init];
self.locationManager.delegate = self;
self.locationManager.distanceFilter = 10.0f;
self.locationManager.desiredAccuracy = kCLLocationAccuracyBest;
[self.locationManager startUpdatingLocation];
self.locations = [NSMutableArray arrayWithCapacity:32];
}
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
我认为这种能力是在第一次实现 CLLocationManager 时出现的。我不确定这是否与外部 GPS 接收器一起使用,但如果您从 GPS 获取纬度/经度,则可以将这些坐标发送到位置管理器。
I think that the ability comes when CLLocationManager is implemented for the first time. I'm not sure if that is what's used with an external GPS receiver but if you're getting the Lat/Long from the GPS, you can send those coordinates to the location manager.