我想实现地理位置通知,如应用程序提醒。 这是我已经做了:地理位置本地通知,如提醒
在应用委托:
self.locationManager = [[[CLLocationManager alloc] init] autorelease]; /* don't leak memeory! */
[self.locationManager setDelegate:self];
[self.locationManager setDesiredAccuracy:kCLLocationAccuracyBest];
-(void)locationManager:(CLLocationManager *)manager didEnterRegion:(CLRegion *)region
{
}
-(void)locationManager:(CLLocationManager *)manager didExitRegion:(CLRegion *)region
{
}
-(void)locationManager:(CLLocationManager *)manager didFailWithError:(NSError *)error
{
}
而这一次的视图控制器巫婆开始监测:
CLLocationCoordinate2D location2D = mapView.region.center;
CLRegion *regionForMonitoring = [[CLRegion alloc] initCircularRegionWithCenter:location2D radius:1 identifier:@"RegionIdentifier"];
[[Utils getLocationManager] startMonitoringForRegion:regionForMonitoring];
现在我没有了解我必须做些什么才能用此信息激发本地通知。
是的,这是... 1米是问题!谢谢!! – Missaq 2012-01-30 16:43:02
太棒了!乐意效劳。感谢你的接纳。 – 2012-01-30 16:45:49
我在挖这个话题。通过这种方法,只有在你的应用程序唤醒时才触发methode'didEnterRegion'。即使您的应用程序未启动,是否可以进行地理定位通知? – 2012-09-28 10:10:15