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
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.
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.
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.
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.
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;
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With