我想通过应用程序在whatsapp上分享应用程序的iTunes URL。 我使用下面的代码:
NSString * urlWhats = [NSString stringWithFormat:@"whatsapp://send?text=Hi, I am using test app. You can also download it from here %@",strUrl];
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 WhatsApp installed." delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil];
[alert show];
}
但是,我无法分享它,因为它包含https网址。 我尝试过在stackoverflow上找到的各种解决方案。
有没有办法做到这一点?
- 更新: 我通过将iTunes网址转换为tinyURL来获得解决方案。 谢谢你的帮助。
- 提前谢谢。