UIActivityViewController PDF only working in the simulator
I have a little problem here. I'm trying to make a UIActivityViewController, where the user can send a PDF (generated by the App) by E-mail or print it with AirPrint. What I have made seems to work in the simulator. I get the mail view with a file attached, and I have succeeded in printing the PDF from the simulator too. But when I test it on my iPhone (5 with iOS 7.1), the UIActivityViewController just say "No share actions available" and provides a cancel button only.
This is the code:
- (IBAction)shareButton:(id)sender {
NSData *pdfData = [NSData dataWithContentsOfFile:@"File.pdf"];
NSArray *activityItems = [NSArray arrayWithObjects: pdfData, nil];
UIActivityViewController *activityController = [[UIActivityViewController alloc] initWithActivityItems:activityItems applicationActivities:nil];
[self presentViewController:activityController animated:YES completion:nil];
}
Can someone spot the error??
链接地址: http://www.djcxy.com/p/94638.html