I am trying to use a URL to launch the n开发者_JAVA百科ative maps application. My build is for 3.1.3 and later. When I run the following code, safari launches with the URL instead of google maps:
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"http://maps.google.com/maps"]];
Any suggestions?
Thanks!
It sounds to me like you are running on the simulator not hardware. This behavior occurs when the map app is not installed or if you are on the simulator.
If you are running on hardware - have you tried that same style with a specific query or location or with http://maps.google.com as the documentation you pointed to mentions that The path cannot be /maps/*. - I'm not sure if that means explicitly *. or if they mean a wildcard. I'm not really clear why you'd want to launch the map app without a specific query.
Your string needs to be @"maps://maps.google.com/..."
. That "maps" at the front of it is what triggers it to load the Maps.app application.
精彩评论