Reputation: 158
I am planning to do GPS location on iPhone. Can you tell me the information regarding GPS (delegates,methods etc).
Upvotes: 2
Views: 615
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
Reputation: 135588
Look up the documentation for CLLocationManager
and CLLocationManagerDelegate
. If you still have specific questions then, come back and ask them.
Upvotes: 3