gpt4 book ai didi

ios - 在 WhatsApp 中分享 YouTube 链接

转载 作者:可可西里 更新时间:2023-11-01 03:31:18 25 4
gpt4 key购买 nike

我正尝试在 Whats App 中与以下人分享 YouTube 链接:

NSURL *whatsappURL = [NSURL URLWithString:@"whatsapp://send?text=http://www.youtube.com/watch?v=lWA2pjMjpBs"];
if ([[UIApplication sharedApplication] canOpenURL: whatsappURL]) {
[[UIApplication sharedApplication] openURL: whatsappURL];
}

但是当 Whats App 打开时,消息框是空的。知道为什么会这样吗?

最佳答案

如果有人遇到同样的问题,我找到了答案:

您只需要对 url 进行编码:

NSString *str = [NSString stringWithFormat:youTubeLink,videoId];

str = (NSString *)CFURLCreateStringByAddingPercentEscapes(NULL,
(CFStringRef)str,
NULL,
CFSTR("!*'();:@&=+$,/?%#[]"),
kCFStringEncodingUTF8);

关于ios - 在 WhatsApp 中分享 YouTube 链接,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18376127/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com