gpt4 book ai didi

ios - 将 Whatsapp 图片发送给 ios 中的特定联系人

转载 作者:行者123 更新时间:2023-11-29 05:24:03 27 4
gpt4 key购买 nike

如何通过 iOS 上的应用程序将图像发送给 Whatsapp 上的特定联系人?

Android 提供 Intent 来将图像分享给特定联系人,例如:

Intent sendIntent = new Intent("android.intent.action.SEND");
File f=new File("path to the file");
Uri uri = Uri.fromFile(f);
sendIntent.setComponent(new ComponentName("com.whatsapp","com.whatsapp.ContactPicker"));
sendIntent.setType("image");
sendIntent.putExtra(Intent.EXTRA_STREAM,uri);
sendIntent.putExtra("jid", PhoneNumberUtils.stripSeparators("919xxxxxxxxx")+"@s.whatsapp.net");
sendIntent.putExtra(Intent.EXTRA_TEXT,"sample text you want to send along with the image");
startActivity(sendIntent);

最佳答案

您可以使用Apple的默认方法UIActivityViewController来共享图像

UIImage *img = [UIImage imageNamed:@"image.png"];

NSArray *arrImg = @[img];

UIActivityViewController *activity = [[UIActivityViewController alloc]
initWithActivityItems:arrImg applicationActivities:nil];


[self presentViewController:activity animated:YES completion:nil]

关于ios - 将 Whatsapp 图片发送给 ios 中的特定联系人,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58370220/

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