【问题标题】:Send Whatsapp image to specific contact in ios将 Whatsapp 图片发送给 ios 中的特定联系人
【发布时间】:2019-10-15 23:23:54
【问题描述】:

如何通过我在 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);

【问题讨论】:

    标签: ios


    【解决方案1】:

    你可以使用苹果的默认方法 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]
    

    【讨论】:

    • 如何在 whatsapp 上分享图片??
    • 这将打开默认的共享活动控制器,如果您的设备上安装了whatsapp,它将在列表中显示whatsapp图标,您可以从该列表中选择whatsapp并在其上共享图像。
    • 但它不会直接向特定联系人分享图片
    • 我的问题是打开特定/一个联系人聊天屏幕并直接发送图像
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-09-24
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多