Klose
Klose

Reputation: 158

iPhone sdk location change notification

I am planning to do GPS location on iPhone. Can you tell me the information regarding GPS (delegates,methods etc).

Upvotes: 2

Views: 615

Answers (2)

ipraba
ipraba

Reputation: 16553

Declare a Location Manager of CLLocation

CLLocationManager *locManager;

In your Function

self.locManager = [[CLLocationManager alloc] init]; 
locManager.delegate = self; 
locManager.desiredAccuracy = kCLLocationAccuracyBest;
[locManager startUpdatingLocation];   // This Method will call the didUpdateToLocation Delegate
[locManager stopUpdatingLocation];   //This Methods stops the GPS from updating

Location Manager Delegate

- (void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation
{
 //Do actions when the GPS is Updating
}
- (void)locationManager:(CLLocationManager *)manager didFailWithError:(NSError *)error
{
    NSLog(@"Error in GPS: %@",error);  
}

Dont forget to include CLLocationManagerDelegate in .h file and Add CoreLocation Framework to your project

Upvotes: 1

Ole Begemann
Ole Begemann

Reputation: 135588

Look up the documentation for CLLocationManager and CLLocationManagerDelegate. If you still have specific questions then, come back and ask them.

Upvotes: 3

Related Questions