Question

I wanna send my location coordinates as a Google Maps link (http://maps.google.com/?saddr=%1.6f,%1.6f) as an SMS but i just can't get it to work... How should I do so that the GoogleMaps-link varies to my location??

MFMessageComposeViewController *controller = [[[MFMessageComposeViewController alloc] init] autorelease];

        controller.body = @"This is my location http://maps.google.com/?saddr=%1.6f,%1.6f";

    NSString *googleMaps = [NSString stringWithFormat:@"http://maps.google.com/?saddr=%1.6f,%1.6f", location.latitude, location.longitude];

    controller.recipients = [NSArray arrayWithObjects:nil];
            controller.messageComposeDelegate = self;
            [self presentModalViewController:controller animated:YES];  
            }
    }

Any ideas? Would really appreciate an answer!!!!

Thanks you and happy holidays!

Was it helpful?

Solution

shouldn't you have:

controller.body = [NSString stringWithFormat:@"http://maps.google.com/?saddr=%1.6f,%1.6f", location.latitude, location.longitude];

you're hard coding the body and then creating an unrelated string which is probably properly formatted and never doing anything with it.

OTHER TIPS

you need to do location.coordinate.latitude, location.coordinate.longitude assuming location is a cllocation object.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top