How to directly open facebook, skype, whatsapp, twitter, evernote from iOS app
Below is the piece of code to directly enter popular apps (facebook, skype, whatsapp, twitter, evernote) installed on the device along with your app ,
If the app is not installed, the code with directly open appstore on iphone to download that app.
else if // FACEBOOK
{
NSString *urlString = [NSString stringWithFormat:@”%@”,
[[UIPasteboard generalPasteboard].string stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]];
NSString *post = [NSString stringWithFormat:@”fb://publish/profile/me?text=%@”,urlString];
BOOL canOpenURL = [[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:post]];
if (canOpenURL) {
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:post]];
}
else{
NSString *str = [NSString stringWithFormat:@”itms-apps://itunes.apple.com/WebObjects/MZStore.woa/wa/viewContentsUserReviews?id=284882215&pageNumber=0&sortOrdering=2&type=Purple+Software”];
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:str]];//&onlyLatestVersion=true
}
}
else if // SKYPE
{
BOOL installed = [[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:@”skype:”]];
if(installed)
{
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@”skype:”]];
}
else
{
NSString *str ;
if(!isIpad)
str= [NSString stringWithFormat:@”itms-apps://itunes.apple.com/WebObjects/MZStore.woa/wa/viewContentsUserReviews?id=304878510&pageNumber=0&sortOrdering=2&type=Purple+Software”];
else
str= [NSString stringWithFormat:@”itms-apps://itunes.apple.com/WebObjects/MZStore.woa/wa/viewContentsUserReviews?id=442012681&pageNumber=0&sortOrdering=2&type=Purple+Software”];
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:str]];//&onlyLatestVersion=true
}
}
else if // TWITTER
{
if([[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:@”twitter://”]]){
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@”twitter://”]];
}
else{
NSString *str = [NSString stringWithFormat:@”itms-apps://itunes.apple.com/WebObjects/MZStore.woa/wa/viewContentsUserReviews?id=333903271&pageNumber=0&sortOrdering=2&type=Purple+Software”];
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:str]];//&onlyLatestVersion=true
}
}
else if // WHATSAPP
{
if([[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:@”whatsapp://”]])
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@”whatsapp://”]];
else{
NSString *str = [NSString stringWithFormat:@”itms-apps://itunes.apple.com/WebObjects/MZStore.woa/wa/viewContentsUserReviews?id=310633997&pageNumber=0&sortOrdering=2&type=Purple+Software”];
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:str]];//&onlyLatestVersion=true
}
}
else if // EVERNOTE
{
if([[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:@”evernote://”]])
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@”evernote://”]];
else{
NSString *str = [NSString stringWithFormat:@”itms-apps://itunes.apple.com/WebObjects/MZStore.woa/wa/viewContentsUserReviews?id=281796108&pageNumber=0&sortOrdering=2&type=Purple+Software”];
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:str]];//&onlyLatestVersion=true
}
}