在一个应用程序中其他的应用,比如说网站,App Store等等
在一个应用程序中启动其他的服务是用方法: UIApplication:openURL
这里罗列了七种服务可以被启动:
1, Browse
2, Google Maps
3, Apple Mail
4, Phone Call
5, SMS Application
6, App Store
?
1, Browse
?
NSURL *url = [NSURL URLWithString:@"http://www.iphonedevelopertips.com"];[[UIApplication sharedApplication] openURL:url];
2, Google Maps
格式:http://maps.google.com/maps?q=${QUERY_STRING}
// Create your query ...NSString* searchQuery = @"1 Infinite Loop, Cupertino, CA 95014";?// Be careful to always URL encode things like spaces and other symbols that aren't URL friendlysearchQuery = [addressText stringByAddingPercentEscapesUsingEncoding: NSUTF8StringEncoding];?// Now create the URL string ...NSString* urlString = [NSString stringWithFormat:@"http://maps.google.com/maps?q=%@", searchQuery];?// An the final magic ... openURL![[UIApplication sharedApplication] openURL:[NSURL URLWithString:urlText]];
3, Apple Mail
格式:mailto://${EMAIL_ADDRESS}
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"mailto://info@iphonedevelopertips.com"]];
4, Phone Call(只是对iPhone)
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"tel://8004664411"]];
5, SMS Application
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"sms:55555"]];
6, App Store
?