ユーザーが特定の地域に到達したときに位置情報ベースのリマインダーが欲しい
そのために、私は次のコードを書きました
CLLocationManager *manager=[[CLLocationManager alloc] init];
manager.desiredAccuracy=kCLLocationAccuracyBest;
manager.delegate=self;
CLLocationCoordinate2D loc;
loc.latitude=LReminder.lat;
loc.longitude=LReminder.lon;
CLRegion *region=[[CLRegion alloc] initCircularRegionWithCenter:loc
radius:LReminder.accuracy dentifier:LReminder.title];
CLLocationAccuracy acc=1.0;
[manager startMonitoringForRegion:region desiredAccuracy:acc];
[manager startMonitoringSignificantLocationChanges];
そしてマネージャーデリゲートの場合
-(void)locationManagerCLLocationManager *)manager didEnterRegionCLRegion *)region
{
NSLog(@"didEnterRegion for %@",region.identifier);
UIAlertView *alr=[[UIAlertView alloc] initWithTitle:@"Reminder didEnterRegion"
message:region.identifier delegate:nil cancelButtonTitle:nil otherButtonTitles:@"Ok",nil];
[alr show];
[alr release];
}
-(void)locationManagerCLLocationManager *)manager didExitRegionCLRegion *)region
{
NSLog(@"didExitRegion for %@",region.identifier);
UIAlertView *alr=[[UIAlertView alloc] initWithTitle:@"Reminder didExitRegion" message:region.identifier delegate:nil cancelButtonTitle:nil otherButtonTitles:@"Ok",nil];
[alr show];
[alr release];
}
問題は、リマインダーの場所に到達したときに、デリゲートのメソッドを呼び出していないことです
私を助けてください