ios - google maps 404 page not found error while routing -
i have problem while using google maps route in iphone app development.
nsstring* apiurlstr = [nsstring stringwithformat:@"http://www.maps.google.com/maps?output=dragdir&saddr=%@&daddr=%@", saddr, daddr];
it returns 404 error : page not found
what should problem?
your url not correct, should use @"http://www.maps.google.com/maps?saddr=%@&daddr=%@"
if try launch google maps iphone's web browser. sample url: http://www.maps.google.com/maps?saddr=22.990236,72.603676&daddr=23.023537,72.529091
for more details google maps url scheme, can visit this documentation.
if want launch native ios google maps iphone, can following:
- (void)test { nsurl *appurl = [[nsurl alloc] initwithstring:[nsstring stringwithformat:@"comgooglemaps://?saddr=%@&daddr=%@", @"22.990236,72.603676", @"23.023537,72.529091"]]; nsurl *weburl = [[nsurl alloc] initwithstring:[nsstring stringwithformat:@"http://www.maps.google.com/maps?saddr=%@&daddr=%@", @"22.990236,72.603676", @"23.023537,72.529091"]]; // if can launch native ios google maps app if ([[uiapplication sharedapplication] canopenurl:appurl]) { [[uiapplication sharedapplication] openurl:appurl]; } // launch web browser, if no native ios google maps app installed else { [[uiapplication sharedapplication] openurl:weburl]; } }
if want draw routes in mapview, can use google maps directions service, can visit this documentation details using directions request url.
Comments
Post a Comment