1

I am developing and App for sharing an audio file with Whatsapp. Since, I am only focused on Whatsapp, I am not interested on showing other available apps such as VLC or Telegram.

Can I select Whatsapp App to share the file without presenting the menu for choosing? In other words, can I avoid presentOpenInMenuFromRect:inView:anmiated:?

dandan78
  • 13,328
  • 13
  • 64
  • 78
CRoig
  • 691
  • 5
  • 24

1 Answers1

0

You need to use UIDocumentInteractionController UTI: net.whatsapp.audio

Custom URL scheme for whatsApp

  _documentController = [UIDocumentInteractionController interactionControllerWithURL:fileURL];
_documentController.delegate = self;
_documentController.UTI = @"net.whatsapp.audio";
[_documentController presentOpenInMenuFromRect:CGRectZero inView:self.view animated:YES]

When triggered, WhatsApp will immediately present the user with the contact/group picker screen. The media will be automatically sent to a selected contact/group.

Sunny Shah
  • 12,990
  • 9
  • 50
  • 86
  • 1
    Thank yo very much. However, I managed to show WhatsApp app in the menu. I was wondering if I can avoid the presentation of the menu, and skip the WhatsApp icon triggering. – CRoig May 21 '14 at 09:19
  • @CRoig - did you manage to solve your original problem? (skip the triggering?) – Boaz Jul 14 '14 at 15:20
  • 1
    I was trying to share music to WhatsApp as well, but even with `_documentController.UTI = @"net.whatsapp.audio";` the Document Controller is showing other apps (dropbox, ifile...) with WhatsApp. Any idea why? – Fouad Aug 27 '14 at 22:16
  • 1
    Nvm, found it. The extension of the file should be `.waa` instead of `.m4a` – Fouad Aug 27 '14 at 22:25