When sharing text to Whatsapp on iOS 8 and below this code is working fine, but while sharing on iOS 9 it is not working.
- (IBAction)btnWhatsApp:(id)sender {
NSString *msg = shareText;
NSString *urlWhats = [NSString stringWithFormat:@"whatsapp://send?text=%@",msg];
NSURL *whatsappURL = [NSURL URLWithString:[urlWhats stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]];
if ([[UIApplication sharedApplication] canOpenURL: whatsappURL]) {
[[UIApplication sharedApplication] openURL: whatsappURL];
}
else {
UIAlertView * alert = [[UIAlertView alloc] initWithTitle:@"WhatsApp not installed." message:@"Your device has no WhatsApp installed." delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil];
[alert show];
}
[self.tabBarController.tabBar setHidden:NO];
[viewShare setHidden:YES];
}