2010-06-23 73 views
6

现在iBooks支持PDF。我的应用可以访问许多PDF文件。是否可以从我的应用程序发送PDF到iBooks(或其他PDF阅读器,如GoodReader和iAnnotate PDF)?发送PDF到iBooks

回答

2

要回答我的问题 - 是的,你可以使用这个PDF文件发送到应用程序支持自定义URL方案为:GOODREADER

[[UIApplication sharedApplication] openURL:[NSURL URLWithString:url]]; 

URL方案:

[email protected]"ghttp://www.mysite.com/myfile.pdf"; 

iAnnotate PDF是:

[email protected]"pdfs://www.mysite.com/myfile.pdf"; 

有谁知道iBooks的自定义URL方案?

+0

ITMS书籍和ITMS-bookss – WrightsCS 2010-08-24 01:50:24

11
//get path to file you want to open 

NSString *fileToOpen = [[NSBundle mainBundle] pathForResource:@"readme" ofType:@"pdf"]; 

//create NSURL to that path 

NSURL *url = [NSURL fileURLWithPath:fileToOpen]; 

//use the UIDocInteractionController API to get list of devices that support the file type 

docController = [UIDocumentInteractionController interactionControllerWithURL:url]; 

[docController retain]; 

//present a drop down list of the apps that support the file type, click an item in the list will open that app while passing in the file. 

BOOL isValid = [docController presentOpenInMenuFromRect:CGRectZero inView:self.view animated:YES]; 
+2

只有我想补充一点,这是不模拟器工作。你必须在硬件上测试。感谢这篇文章。 – Louie 2011-05-31 05:08:13

+0

@Louie ty。我无法弄清楚发生了什么事。 – jrwren 2012-01-06 16:41:03

0

使用此链接找到URL方案http://schemes.zwapp.com/

,并使用[[UIApplication sharedApplication] openURL:url];

在应用程序启动。

感谢