1
我是新来的flex移动应用程序开发,我想通过whatsapp
分享一个文本。这是一些代码,但它不工作。通过whatsapp发送文本无法正常工作
navigateToURL(new URLRequest("whatsapp://send?text=Hello how r u???")
你能帮我吗。 在此先感谢。
我是新来的flex移动应用程序开发,我想通过whatsapp
分享一个文本。这是一些代码,但它不工作。通过whatsapp发送文本无法正常工作
navigateToURL(new URLRequest("whatsapp://send?text=Hello how r u???")
你能帮我吗。 在此先感谢。
试试看看这个代码。应该完美地工作。
-(void)whatsapp{
NSString *massage = [self stringByEncodingString:@"Your massage"];
NSString *urlWhats = [NSString stringWithFormat:@"whatsapp://send?text=%@",massage];
NSURL *whatsappURL = [NSURL URLWithString:urlWhats];
if ([[UIApplication sharedApplication] canOpenURL: whatsappURL]) {
[[UIApplication sharedApplication] openURL: whatsappURL];
} else {
UIAlertView * alert = [[UIAlertView alloc] initWithTitle:@"WhatsApp not installed." message:@"Your device has to have WhatsApp installed." delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil];
[alert show];
}
}
-(NSString *)stringByEncodingString:(NSString *)string{
CFStringRef encodedString = CFURLCreateStringByAddingPercentEscapes(NULL, (CFStringRef)string, NULL,
(CFStringRef)@"!*'();:@&=+$,/?%#[]", kCFStringEncodingUTF8);
return CFBridgingRelease(encodedString);
}
在这里找到的解决方案? – Yossi
没有。通过邮件联系WhatsApp团队后,我才知道这不是可能的,因为whatapp没有提供任何第三方API。如果你有任何解决方案,请在这里评论@Yossi –
其实我得到了。请看下面的答案。 – Yossi