2013年3月15日 星期五

在自己的App中打開iOS中其他App的方式

//直接跳到iOS Settings (iOS 8以上限定)
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:UIApplicationOpenSettingsURLString]];

//How to check whether the app is installed in iOS device or not?
BOOL isAppInstalled=[[UIApplication sharedApplication] canOpenURL: [NSURL URLWithString:@"APP-URL-Scheme"]];
if(isAppInstalled) {
// app launching code
}else {
// app download prompting code
}

//Sending a Mail from iOS App
[[UIApplication sharedApplication] openURL:[NSURL URLWithString: @mailto:krish@krish.codeworth.com]];

//Making a Phone Call from iOS app
[[UIApplication sharedApplication] openURL:[NSURL URLWithString: @"tel:1-408-555-5555"]];

//Sending an SMS from the iOS App
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"sms:"]];
or
[[UIApplication sharedApplication] openURL:[NSURL URLWithString: @"sms:1-408-555-1212"]];


//開apple maps
[[UIApplication sharedApplication] openURL:[NSURL URLWithString: @"http://maps.apple.com/maps?q=taiwan"]];

//開google maps
[[UIApplication sharedApplication] openURL:[NSURL URLWithString: @"http://maps.google.com/maps?q=taiwan"]];

//開maps加導航
[[UIApplication sharedApplication] openURL:[NSURL URLWithString: @"http://maps.google.com/maps?daddr=San+Francisco,+CA&saddr=cupertino"]];


//Opening YouTube App
[[UIApplication sharedApplication] openURL:[NSURL URLWithString: @"http://www.youtube.com/watch?v=VIDEO_IDENTIFIER"]];
or
[[UIApplication sharedApplication] openURL:[NSURL URLWithString: @"http://www.youtube.com/v/VIDEO_IDENTIFIER"]];

//Opening iTunes App
[[UIApplication sharedApplication] openURL:[NSURL URLWithString: @"http://phobos.apple.com/WebObjects/MZStore.woa/wa/viewAlbum?i=156093464&id=156093462&s=143441"]];

//Opening App Store App
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"Copied iTunes Store URL"]];

//Opening iBooks App
NSString *stringURL = @”itms-books:”; NSURL *url = [NSURL URLWithString:stringURL]; [[UIApplication sharedApplication] openURL:url];

沒有留言:

張貼留言