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



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

Android 提供将图像共享给特定联系人的意图,例如:

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]

最新更新