Is it possible to allow the iOS user to email a locally stored PDF document (contained within the app bundle)?
I already have a function in my project that allows the user to email the link of the page the webView is displaying, but I would like them to be able to email the locally stored PDF rather than just a link to a corresponding web address.
When I touch "Mail link to this Page" it creates a link to the local document like file:///...
I'm using this to display the local file:
SVModalWebViewController *webViewController = [[SVModalWebViewController alloc] initWithURL:[NSURL fileURLWithPath:[[NSBundle mainBundle] pathForResource:@"Military-Storage-Solutions" ofType:@"pdf"]]];
It should be easy for you to access the file directly and obtain it's data, and after that, using MFMailComposeViewController insert the following code somewhere:
NSData *data = // pdf data
NSString *fileName = @"thename.pdf";
NSString *mimeType = @"proper pdf mimetype";
[mailComposeViewController addAttachmentData:data mimeType:mimeType fileName:fileName];