1

私は位置情報ベースのアプリを持っています。地域は正しいのですが、アプリが移動しdidEnterRegionたり移動したりしません。didExitRegion

for (int x = 0; x <= [[[TaskStore sharedStore] allTasks]count]-1; x++)
{
    NSArray *tasks = [[TaskStore sharedStore] allTasks];
    Task *selectedTask = [tasks objectAtIndex:x];

    location.latitude  = selectedTask.locationCoord.coordinate.latitude;
    location.longitude = selectedTask.locationCoord.coordinate.longitude;
    NSString* desiriedLoc = [selectedTask locationName];


    CLRegion *region = [[CLRegion alloc] initCircularRegionWithCenter: location radius: 30.0 identifier: desiriedLoc];
    NSLog(@"Entered new Location in Region %@", region);

    [locManager startMonitoringForRegion:region];

}

-(void)locationManager:(CLLocationManager *)manager didEnterRegion:(CLRegion *)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];
}

-(void)locationManager:(CLLocationManager *)manager didExitRegion:(CLRegion *)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];
}

これは私の場所から出力された文字列です:

座標で新しい場所を入力しました 緯度: 51.509980 経度: -0.133700

そして、これは地域から出力された文字列です:

リージョン (識別子ロンドン) <+51.50998000,-0.13370000> 半径 30.00m に新しい場所を入力しました

4

3 に答える 3

0

ターゲット リージョンにいる間に監視を開始すると、何もトリガーされません。実際には「didEnterRegion」イベントではないためです。

于 2014-01-16T05:46:31.070 に答える