objective c - how to get the current location position in map on iphone -


I am creating an application in which I want to get the user's current location and display it on the map And when the user reaches the destination from the current location, the destination should also point to the map along with the direction of travel. I have added a button in my xib & amp; Click the button (showDirectionsToHere) I've said the map I've added the following code in my code but it gives me an error:

  - (zero) locationManager: (CLLocationManager *) Manager didUpdateToLocation New place from place (CLLocation *): (CLLocation *) Old location {{manager stopupdating location]; Printf ("\ nLatitude =" "\ nLength =" ", [NSString stringWithFormat: @"% .7f ", new location.CordinateLatidate], [NSString stringWithFormat: @"% .7f ", newLocation.coordinate. Longitude]);} - (BOOL) application: (UIApplication *) applied FinishLaunchingWithOptions: (NSDictionary *) launch Option {CLLocationManager * locationManager = [[[CLLocationManager alloc] init] autorelease]; LocationManager.delegate = self; [LocationManager startUpdatingLocation ]; //[self.window addSubview: viewController.view]; [create a window and learn]; Yes return;} - (empty) Location Manager: (CLLocationManager *) Manager did FailWithError: (NSError *) Error {printf ("\ nerror");} - (IBAction) showDirectionsTo Here {CLLocationCoordinate2D current location = [self get in place]; // line 1 NSString * url = [NSString stringWithFormat: @ "http://maps.google.com/maps?saddr=old\%20Location&daddr=%f ,% f ", new Sthanklatidud new location. Langpat], line 2}   

action line (showDirectionsHere) 1 I get an error invalid initializer in line 2 I error It is found that the new location is undeclared. Please help me

Can you post the code for getCurrentLocation so we see that that it returns the variable new location is undeclared I think you mean is current location function

Comments