在一个应用程序中调用其他的应用,比如说网站,App Store等等
In an earlier post I talked about how to launch the browser from within an iPhone application using the UIApplication:openURL:
method.
It is also possible to use this same technique to launch other applications on the iPhone that are very useful.
Examples of some of the key applications that you can launch via URL are:
Launch Google MapsLaunch Apple MailDial a Phone NumberLaunch the SMS ApplicationLaunch the BrowserLaunch the AppStore?
Launch Google MapsThe URL string for launching Google Maps with a particular keyword follows this structure:
http://maps.google.com/maps?q=${QUERY_STRING}
The only trick to this is to ensure that the value for the ${QUERY_STRING} is properly URL encoded. Here is a quick example of how you would launch Google Maps for a specific address:
Copy iTunes Store URL .The URL will look something like this:
http://phobos.apple.com/WebObjects/MZStore.woa/wa/viewSoftware?id=291586600&mt=8
Launching the AppStore URL is exactly the same as you would launch the browser. Using the link above, here is an example of how we would launch the AppStore:
12
NSURL *appStoreUrl = [NSURL URLWithString:@"http://phobos.apple.com/WebObjects/MZStore.woa/wa/viewSoftware?id=291586600&mt=8"];[[UIApplication sharedApplication] openURL:appStoreUrl];