objective c - Share an Image and Text on WhatsApp in IOS programmatically? -


i add image , text in whatsapp of coding. how can perform solve problem?

you can post image or text on whatsapp. wont post both @ time becouse whatsapp not provide api can add caption , post image text.

following example posting image iphone app whatsapp par whatsapp documentation:

in viewcontroller.h file:

@interface viewcontroller : uiviewcontroller { }  @property(nonatomic,retain) uidocumentinteractioncontroller *documentationinteractioncontroller; 

in viewcontroller.m file:

- (ibaction)bocclick:(uibutton *)sender {       nsarray *paths = nssearchpathfordirectoriesindomains(nsdocumentdirectory,     nsuserdomainmask, yes);     nsstring *documentsdirectory = [paths objectatindex:0];      nsstring *getimagepath = [documentsdirectory stringbyappendingpathcomponent:@"savedimage.png"]; //here fetched image path document directory , convert in url , 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 ) interactiondelegate {        self.documentationinteractioncontroller =      [uidocumentinteractioncontroller interactioncontrollerwithurl: fileurl];      self.documentationinteractioncontroller.delegate = interactiondelegate;        return self.documentationinteractioncontroller;  } 

Comments

Popular posts from this blog

powershell Start-Process exit code -1073741502 when used with Credential from a windows service environment -

twig - Using Twigbridge in a Laravel 5.1 Package -

c# - LINQ join Entities from HashSet's, Join vs Dictionary vs HashSet performance -