ios - UIActivityViewController sharing image via email has no extension -


the image attached "attachment-1", no extension. how specify 1 ?

    nsdata *compressedimage = uiimagejpegrepresentation(self.resultimage, 0.8 );      uiactivityviewcontroller *activityviewcontroller = [[uiactivityviewcontroller alloc] initwithactivityitems:@[ @"check out!", compressedimage ] applicationactivities:nil];      [self.navigationcontroller presentviewcontroller:activityviewcontroller animated:yes completion:nil]; 

according this answer should able use workaround specify filename

nsdata *compressedimage = uiimagejpegrepresentation(self.resultimage, 0.8 ); nsstring *docspath = [nssearchpathfordirectoriesindomains(nsdocumentdirectory, nsuserdomainmask, yes) objectatindex:0]; nsstring *imagepath = [docspath stringbyappendingpathcomponent:@"image.jpg"]; nsurl *imageurl     = [nsurl fileurlwithpath:imagepath];  [compressedimage writetourl:imageurl atomically:yes]; // save file uiactivityviewcontroller *activityviewcontroller = [[uiactivityviewcontroller alloc] initwithactivityitems:@[ @"check out!", imageurl ] applicationactivities:nil]; 

the obvious drawback of approach have save image on disk.


Comments

Popular posts from this blog

monitor web browser programmatically in Android? -

Shrink a YouTube video to responsive width -

wpf - PdfWriter.GetInstance throws System.NullReferenceException -