2010-06-23 75 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];

在應用程序啓動。

感謝