iOS share image AND text to WhatsApp

后端 未结 5 776
猫巷女王i
猫巷女王i 2020-12-23 14:11

I have googled, and get some solutions, it seems the only possible way is thru UIDocumentInteractionController. I have found the result that able to share

5条回答
  •  挽巷
    挽巷 (楼主)
    2020-12-23 14:40

    Please check below project on github

    https://github.com/salesawagner/SharingWhatsApp

    typedef enum{
        kSendText = 0,
        kSendImage,
        kSendTextWithImage,
        kSendAudio,
        kSendCancel
    } options;
    - (void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex{
    
        switch (buttonIndex) {
            case kSendText:
                [[WASWhatsAppUtil getInstance] sendText:@"Text"];
                break;
            case kSendImage:
                [[WASWhatsAppUtil getInstance] sendImage:[UIImage imageNamed:@"image.jpg"] inView:self.view];
                break;
            case kSendTextWithImage:
                NSLog(@"Send text with image");
            case kSendAudio:
                [[WASWhatsAppUtil getInstance] sendAudioinView:self.view];
                break;
            default:
                NSLog(@"Cancel send");
                break;
        }
    
    }
    

提交回复
热议问题