i want to get the GPS coordinates from iphone and send these GPS coordinates to web service. This web service, will take my GPS Coordinates and send me the location of the near
Import CoreLocation framework to app
import CoreLocation/CoreLocation.h librarie to ViewController
edit ViewController header file
#import
#import
@interface EMViewController : UIViewController {
CLLocationManager *locationManager;
}
@end
initialize locationManager in ViewController implementation
- (void)viewDidLoad
{
[super viewDidLoad];
locationManager = [[CLLocationManager alloc] init];
[locationManager startUpdatingLocation];
NSLog(@" lat: %f",locationManager.location.coordinate.latitude);
NSLog(@" lon: %f",locationManager.location.coordinate.longitude);
[locationManager stopUpdatingLocation];
}