我正在使用以下代码监控我的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上使此功能正常工作还需要什么呢?
谢谢!