Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

WhatsApp image sharing iOS [closed]

I am developing an iOS application in which i have to share image on WhatsApp from my application. I found this code but it deals with only text sharing https://github.com/jberlana/JBWhatsAppActivity

like image 949
IronMan Avatar asked Dec 06 '13 05:12

IronMan


People also ask

Why can't I share photos from iPhone to WhatsApp?

Check App Permissions Here's how to fix that. Step 1: Open Settings on iPhone, scroll down to WhatsApp and open it. Step 2: Allow all the required permissions by enabling their respective toggles. Restart WhatsApp and try sending those photos again.

Why can I not share photos on WhatsApp?

If you're experiencing issues downloading or sending photos, videos, or voice messages, check the following: Your phone has an active internet connection with a strong signal. Try loading a webpage to make sure. Your phone's date and time are set correctly.

Is WhatsApp shutting down for iPhone?

Now, the app is reportedly going to stop working on nearly 50 iPhones and Android smartphones in 2022. The list includes iPhone 6S, iPhone SE, Samsung Galaxy phones, Sony Xperia M, HTC Desire 500, LG Optimus F7, and many others. This will affect millions of WhatsApp users.

How do I enable photo sharing on WhatsApp?

Once you are in the Album, select the Photo that you want to share by tapping on it. Once the Photo is selected, tap on the Sharing Icon Icon located at bottom left-corner. 3. On the Sharing Menu that appears, select WhatsApp.


1 Answers

That can be Possible using documentationInteractionController. Recently I have done this using bellow code to share image From our App to whatsApp, Line, WeChat but while you click on WhatsApp icon, then you are navigation WhatsApp app from you app and you must return you app manually. That does not redirect again after ImageSharing.

in .h file:-

@interface ViewController : UIViewController<UIDocumentInteractionControllerDelegate>
{
}

@property(nonatomic,retain) UIDocumentInteractionController *documentationInteractionController;

in .m file

- (IBAction)bocClick:(UIButton *)sender {


    NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,     NSUserDomainMask, YES);
    NSString *documentsDirectory = [paths objectAtIndex:0];

    NSString *getImagePath = [documentsDirectory stringByAppendingPathComponent:@"savedImage.png"]; //here i am fetched image path from document directory and convert it in to URL and use bellow


    NSURL *imageFileURL =[NSURL fileURLWithPath:getImagePath];
    NSLog(@"imag %@",imageFileURL);

    self.documentationInteractionController.delegate = self;
    self.documentationInteractionController.UTI = @"net.whatsapp.image";
    self.documentationInteractionController = [self setupControllerWithURL:imageFileURL usingDelegate:self];
    [self.documentationInteractionController presentOpenInMenuFromRect:CGRectZero inView:self.view animated:YES];


}

- (UIDocumentInteractionController *) setupControllerWithURL: (NSURL*) fileURL

                                               usingDelegate: (id <UIDocumentInteractionControllerDelegate>) interactionDelegate {



    self.documentationInteractionController =

    [UIDocumentInteractionController interactionControllerWithURL: fileURL];

    self.documentationInteractionController.delegate = interactionDelegate;



    return self.documentationInteractionController;

}
like image 135
Nitin Gohel Avatar answered Oct 27 '22 00:10

Nitin Gohel