PDF and MFMailComposeViewController

Writing the part of the app that allows the user to generate a pdf and send it. Seems to be working fine. The sent PDF opens fine on the MAC, but on the iPhone it just keeps loading and never opens. Created a pdf document with the help of Ray Wenderlich Tutorial and sent it out through a modal view controller with a instance of an MFMailComposeViewController. WTF am i doing wrong.

Update: The PDF also opens fine on the Ipad. Could the problem be somewhere in the code for creating the PDF? Also it is a little unclear to me if I am actually creating a PDF that is persisting and then getting replaced after each new version of the same named file or am I somehow tricking the compiler into thinking a doc is getting stored so I can send it out with the least code possible.

Any thoughts on this would be appreciated.

check out the code:

if ([MFMailComposeViewController canSendMail])

MFMailComposeViewController *picker = [[MFMailComposeViewController alloc] init];
picker.mailComposeDelegate = self;

[picker setSubject:@"mail test"];

NSString* fileName = @"Invoice.PDF";
NSArray *arrayPaths =
NSString *path = [arrayPaths objectAtIndex:0];
NSString* pdfFileName = [path stringByAppendingPathComponent:fileName];
NSData *myData = [NSData dataWithContentsOfFile:pdfFileName];

[picker addAttachmentData:myData mimeType:@"application/pdf" fileName:@"the PDF"];
[self presentModalViewController:picker animated:YES];



try this way

 [picker addAttachmentData:myData mimeType:@"application/pdf" fileName:@"thePDF.pdf"]; 

BTW, if you are generating the PDF content just before sending it, you don't need to save to a real pdf file, just send the PDF data

Need Your Help

Find Number of “-” in a table

sql sql-server-2008

I am trying to find number of "-" in a table,i am using this query but its not working

Determining the number of parameters accepted by a method

c# string methods parameters

Is it possible to get the number of parameters accepted by a method and then access the values of these parameters individually? I want to create a method which concatenates the values of all the

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.