【发布时间】:2013-10-18 11:24:49
【问题描述】:
我正在使用以下代码来监控我的 iOS 应用程序中的区域。当我在 iOS6 上构建应用程序时,它可以完美运行。当我在 iOS7 上构建它时,没有触发 didEnterRegion。
// 在 iOS 中创建和注册一个区域
CLLocationCoordinate2D venueCenter = CLLocationCoordinate2DMake([favoriteVenue.venueLat doubleValue], [favoriteVenue.venueLng doubleValue]);
CLRegion *region = [[CLRegion alloc] initCircularRegionWithCenter:venueCenter radius:REGION_RADIUS identifier:favoriteVenue.venueId];
AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
[appDelegate.locationManager startMonitoringForRegion:[self regionForVenue:favoriteVenue]];
//在AppDelegate.m中
- (void)locationManager:(CLLocationManager *)manager didEnterRegion:(CLRegion *)region
{
NSLog(@"Entered region: %@", region.identifier);
}
我还在我的 plist 文件中将所需的后台模式设置为“应用程序注册以进行位置更新”。
对于在 iOS7 上运行此功能缺少什么有什么想法吗?
谢谢!
【问题讨论】:
标签: ios7 cllocationmanager clregion clcircleregion