I'm using the following code to share an image via WhatsApp
-(void)shareImageUsingDocumentController:(UIImage *)image fileName:(NSString *)fileName UTI:(NSString *)UTI completion:(void (^)(SharingResult sharingResult))completion
{
if (completion)
{
self.shareCompleted = completion;
}
self.documentInteractionController = nil;
self.documentInteractionController = [[UIDocumentInteractionController alloc] init];
NSURL *localUrl = [self writeLocalFileFromUIImage:image fileName:fileName];
if (localUrl != nil) {
self.documentInteractionController.URL = localUrl;
self.documentInteractionController.UTI = UTI;
self.documentInteractionController.delegate = self;
[self presentDocumentIneractionController];
}
}
-(UIViewController *)documentInteractionControllerViewControllerForPreview:(UIDocumentInteractionController *)controller
{
return self.presentingViewController;
}
This is from the BDSshare library and I'm using it from a Swift app. I'm calling the function with this code.
img: UIImage = self.loadImage()
BDGShare.shared().shareImage(usingDocumentController: img, fileName: "whatsAppTmp.wai", uti: "net.whatsapp.image") {(SharingResult) -> Void in
// Handle share result...
self.handleShareResult(shareTarget.type, shareResult: SharingResult)
}
The problem I'm having is that I see two icons for WhatsApp in the controller.
Can anyone see why there would be two WhatsApp icons here? I've been searching all over and I can't find any posts that do this differently than I am. I can't find any one mentioning the issue of having multiple WhatsApp icons either. If I use the first icon (labeled 'WhatsApp') then it doesn't actually work. I select a contact and hit send and I get a screen with the filename in it. Using the second button (labeled 'Copy to WhatsApp') I select a contact and I see the image on black screen with a text entry for caption.
I'd much rather skip the selector and go straight to WhatsApp but I'd settle for only one button (naturally the one that works ;))
TIA Mike