【发布时间】:2016-05-11 13:06:21
【问题描述】:
在 iOS 8 及以下版本上与 Whatsapp 共享文本时,此代码运行良好,但在 iOS 9 上共享时,它无法运行。
- (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];
}
【问题讨论】:
-
你遇到了什么错误?
标签: ios objective-c swift