在whatsapp上共享URL - iOS

时间:2015-11-29 16:34:30

标签: ios objective-c ios9 whatsapp

我想通过应用程序在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来获得解决方案。 谢谢你的帮助。

- 提前谢谢。

0 个答案:

没有答案
相关问题