Tuesday, 6 November 2012

Directly open up the map from the running app in iPhone

NSString* address = @"118 Your Address., City, State, ZIPCODE";
NSString* currentLocation = @"Current Location";
NSString* url = [NSString stringWithFormat: @"http://maps.google.com/maps?saddr=%@&daddr=%@",[currentLocation stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding],[address stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]];
   UIApplication *app = [UIApplication sharedApplication];
[app openURL: [NSURL URLWithString: url]];

No comments:

Post a Comment