objective c - Can i copy an image from my application to mail app in iOS -


i developing native ios application.

i have requirement copy image application mail app, how can accomplish task kindly suggest me.

thanks in advance..

using mfmailcomposeviewcontroller

mfmailcomposeviewcontroller *mail=[mfmailcomposeviewcontroller alloc]init];

// determine file name , extension

nsstring *extension =@"png";

nsstring * filename=@"email";

// resource path , read file using nsdata

nsstring *filepath = [[nsbundle mainbundle] pathforresource:filename oftype:extension];

nsdata *filedata = [nsdata datawithcontentsoffile:filepath];

// determine mime type

nsstring *mimetype; if ([extension isequaltostring:@"jpg"])  {     mimetype = @"image/jpeg"; }  else if ([extension isequaltostring:@"png"]) {     mimetype = @"image/png"; }  else if ([extension isequaltostring:@"doc"])  {     mimetype = @"application/msword"; }  else if ([extension isequaltostring:@"ppt"]) {     mimetype = @"application/vnd.ms-powerpoint"; }  else if ([extension isequaltostring:@"html"]) {     mimetype = @"text/html"; } else if ([extension isequaltostring:@"pdf"]) {     mimetype = @"application/pdf"; } 

// add attachment

[mail addattachmentdata:filedata mimetype:mimetype filename:filename]; 

Comments

Popular posts from this blog

windows - Single EXE to Install Python Standalone Executable for Easy Distribution -

c# - Access objects in UserControl from MainWindow in WPF -

javascript - How to name a jQuery function to make a browser's back button work? -