Advertise here




Advertise here

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Share file audio via WhatsApp, please help me

passericpasseric Molare, ItaliaPosts: 1New Users Noob
edited January 2015 in iOS SDK Development
This is a code fore share image via WhatsApp
But i can not understand how to modify it to send the audio file.
If anyone knows me can write modified? Please.

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



    if ([[UIApplication sharedApplication] canOpenURL: [NSURL URLWithString:@"whatsapp://app"]]){



        UIImage     * iconImage = [UIImage imageNamed:@"NAMEIMAGE.jpeg"];

        NSString    * savePath  = [NSHomeDirectory() stringByAppendingPathComponent:@"Documents/whatsAppTmp.wai"];



        [UIImageJPEGRepresentation(iconImage, 1.0) writeToFile:savePath atomically:YES];



        _documentationInteractionController = [UIDocumentInteractionController interactionControllerWithURL:[NSURL fileURLWithPath:savePath]];

        _documentationInteractionController.UTI = @"net.whatsapp.image";

        _documentationInteractionController.delegate = self;



        [_documentationInteractionController presentOpenInMenuFromRect:CGRectMake(0, 0, 0, 0) inView:self.view animated: YES];





    } else {

        UIAlertView * alert = [[UIAlertView alloc] initWithTitle:@"Errore" message:@"Sul tuo dispositivo non è installato WhatsApp." delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil];

        [alert show];

    }

}



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



                                               usingDelegate: (id ) interactionDelegate {







    self.documentationInteractionController =



    [UIDocumentInteractionController interactionControllerWithURL: fileURL];



    self.documentationInteractionController.delegate = interactionDelegate;







    return self.documentationInteractionController;



}
Post edited by UIUs on

Replies

  • UIUsUIUs Posts: 165Moderators Admin
    edited January 2015
    Don't post multiple posts asking the same question. It just clutters up the board. Use the Edit function if you have more info to add. I have removed your other post.

    Do use Code Tags to format your code. It makes it easier to read, and users will be more likely to help you. I have edited it for you.

    For future, don't leave huge spaces between your lines of code. It makes it hard to read, and makes the post overly long.

    Welcome aboard.
Sign In or Register to comment.