Before ios9 comes, I used following code to open facebook app with my app when button clicked.using this if the phone has facebook app, it opens the facebook app and, if it is not, it opens the safari browser.same for the twitter.this is my code.
- (IBAction)facebookButton:(id)sender {
NSURL *facebookUrl = [NSURL URLWithString:@"fb://profile/number"];
if ([[UIApplication sharedApplication] canOpenURL:facebookUrl]) {
[[UIApplication sharedApplication] openURL:facebookUrl];
}
else{
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"http://www.facebook.com/number"]];
}
}
- (IBAction)twitterButton:(id)sender {
NSURL *twitterUrl = [NSURL URLWithString:@"twitter://profile/"];
if ([[UIApplication sharedApplication] canOpenURL:twitterUrl]) {
[[UIApplication sharedApplication] openURL:twitterUrl];
}
else{
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"http://www.twitter.com/"]];
}
}
this worked fine, before iOS 9.but now if app exists or not, it only opens with safari.help me with this