如何在iOS中集成whatsapp [英] how to integrate whatsapp in ios

查看:544
本文介绍了如何在iOS中集成whatsapp的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我现在正在尝试在我们的应用程序中集成什么应用程序

hi now i am trying Integrate What's app in our app

我已经完成了整合推文

:-在此应用程序中,我创建了两个按钮 一个(chooseImagePressed)按钮是选择图像形式的本地文件,然后 然后第二个(tweetButtonPressed)这会将图像发布到高音扬声器

:-in this app i create two buttons one(chooseImagePressed) button is choose the image form local file and then and then second(tweetButtonPressed) this is post the image to Tweeter

- (IBAction)tweetButtonPressed:(id)sender
{
    if ([SLComposeViewController isAvailableForServiceType:SLServiceTypeTwitter])
    {
        SLComposeViewController *tweetSheet = [SLComposeViewController composeViewControllerForServiceType:SLServiceTypeTwitter];
        [tweetSheet setInitialText:@"Look at this nice picture!"];

        [tweetSheet addImage:self.imageView.image];

        [self presentViewController:tweetSheet animated:YES completion:nil];
    }
    else
    {
        UIAlertView *alertView = [[UIAlertView alloc]
                                  initWithTitle:@"Error"
                                  message:@"please setup Twitter"
                                  delegate:self
                                  cancelButtonTitle:@"OK"
                                  otherButtonTitles:nil];
        [alertView show];
    }
}

- (IBAction)chooseImagePressed:(id)sender
{
    self.pickerController = [[UIImagePickerController alloc] init];

    self.pickerController.delegate = self;
    self.pickerController.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;

    [self presentViewController:self.pickerController animated:YES completion:nil];
}

#pragma mark 

- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info;
{
    self.imageView.image = [info objectForKey:UIImagePickerControllerOriginalImage];

    [self dismissViewControllerAnimated:YES completion:nil];
}

请给我有关如何将什么应用程序集成到我们的应用程序中的任何想法

Please give me any idea about the how to integrated what's app into our app

请告诉我这是否可行

谢谢

推荐答案

,不可能as like tweeter and Facebook api.但是,如果已经按如下所示安装了whatsapp,则可以将消息从您的应用程序发送到whatsapp

No, It's not possible as like tweeter and Facebook api. But you can send message from your app to whatsapp if whatsapp is already installed as below

NSURL *whatsappURL = [NSURL URLWithString:@"whatsapp://send?text=Hello%2C%20World!"];//use this method stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding to convert it with escape char
if ([[UIApplication sharedApplication] canOpenURL: whatsappURL]) {
    [[UIApplication sharedApplication] openURL: whatsappURL];
}

但是,如果您要共享文件,图像,视频之类的文档,则必须通过

But If you want to share document like files, images, video, you've to send it via UIDocumentInteractionController.

注意:应该为以上两个安装whatsapp,否则您将无法做任何事情. 有关最新的whatsApp文档,请参见此.

Note: whatsapp should be installed for above two, otherwise you can't do anything as you like. See this for current whatsApp doc.

这篇关于如何在iOS中集成whatsapp的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆