1
我已经开发了ios应用程序,它支持iPhone & iPad。monitoringDidFailForRegion只呼吁ipad
在该应用程序中,我集成了位置跟踪功能。
这是我如何实现它。
//start monitoring for region for checked in location
CLLocationCoordinate2D centerCoordinate = CLLocationCoordinate2DMake(latitude,longtitude);
regionalMonitor = [[CLRegion alloc] initCircularRegionWithCenter:centerCoordinate radius:REGIONAL_MONITOR_RADIOUS identifier:@"checkedIn"];
[locationManager startMonitoringForRegion:regionalMonitor];
- (void)locationManager:(CLLocationManager *)manager didEnterRegion:(CLRegion *)region
{
NSLog(@"didEnterRegion");
}
- (void)locationManager:(CLLocationManager *)manager didExitRegion:(CLRegion *)region
{
NSLog(@"didExitRegion");
}
- (void)locationManager:(CLLocationManager *)manager monitoringDidFailForRegion:(CLRegion *)region withError:(NSError *)error
{
NSLog(@"Region monitoring failed with error: %@", [error localizedDescription]);
}
这个方法在iphone应用程序中是完美的。但是当我尝试在ipad中执行它们时
monitoringDidFailForRegion
方法将被调用。但它在ipad模拟器中完美运行。
有没有什么特别的原因,或者是这个面向设备的错误。因为如果我评论
[locationManager startMonitoringForRegion:regionalMonitor];
然后,它会不会叫monitoringDidFailForRegion方法
日志消息 - 地区监测失败,出现错误:操作无法完成。
感谢
你好,谢谢你的提示。我用这种方法检查了regionMonitoringAvailable。它返回false。但我真的需要这个东西的工作。对于这个 –
@先生G:是的。我可以说,在iPad上禁用3g/4g的功能。 – Linuxios
是的,我同意。我发现了一篇不错的文章,说ipad 2 wi-fi版本doent具有区域监视功能。 –