1

いくつかの場所のバスの近くにいるときに通知するアプリケーションを作成しようとしていますが、まだ機能していません。これが私が使用したコードです

self.locationManager = [[[CLLocationManager alloc] init] autorelease];
locationManager.delegate = self;

locationManager.desiredAccuracy=kCLLocationAccuracyBestForNavigation;

locationManager.distanceFilter = 5;

[locationManager startUpdatingLocation];

CLLocationCoordinate2D loc;

loc.latitude = 30.794253 ;
loc.longitude = 31.012369 ;

[CLLocationManager regionMonitoringEnabled];

alslamMosque =[[CLRegion alloc]initCircularRegionWithCenter:loc radius:800 identifier:@"alslam"];

[locationManager startMonitoringForRegion:alslamMosque desiredAccuracy:50];

[locationManager startMonitoringSignificantLocationChanges];

と代表団

(void)locationManager:(CLLocationManager *)managerdidEnterRegion:(CLRegion *)region __OSX_AVAILABLE_STARTING(__MAC_10_7,__IPHONE_4_0)
{

    UIAlertView *alr=[[UIAlertView alloc]
                                  initWithTitle:@"Reminder didEnterRegion" 
                                  message:region.identifier delegate:nil 
                                  cancelButtonTitle:nil otherButtonTitles:@"Ok",nil];

    [alr show];

    [alr release];

} 




(void)locationManager:(CLLocationManager *)managerdidExitRegion:(CLRegion *)region __OSX_AVAILABLE_STARTING(__MAC_10_7,__IPHONE_4_0)
{

     UIAlertView *alr=[[UIAlertView alloc] 
                                    initWithTitle:@"Reminder didExitRegion" 
                                    message:region.identifier delegate:nil 
                                    cancelButtonTitle:nil otherButtonTitles:@"Ok",nil];
     [alr show];

     [alr release];
 }
4

1 に答える 1