Open iBooks from my application

I have a PDF file in my application. I want to provide the opportunity to open this PDF file in another application of third-party electronic devices that can be installed on the device, for example, Stanza and iBooks. The Dropbox application has successfully implemented this feature, and I cannot find any information on how to determine which other electronic devices are available on the device, or the layout of user URLs for these applications. Any help would be greatly appreciated. thanks in advance guys.

+3
source share
4 answers

NSString *stringURL = @"itms-books:";

NSURL *url = [NSURL URLWithString:stringURL];

[[UIApplication sharedApplication] openURL:url];

NSString *stringURL = @"itms-bookss:";

NSURL *url = [NSURL URLWithString:stringURL];

[[UIApplication sharedApplication] openURL:url];
+2

NSURL :

NSURL *url = [NSURL fileURLWithPath:file.FileName];

file.FileName --> your local file path where the document is stored in the local db.

UIDocumentInteractionController    *docController = [UIDocumentInteractionController interactionControllerWithURL:url];

docController.delegate = self;

[docController retain];

[docController presentOpenInMenuFromRect:CGRectZero inView:self.view animated:YES];

:

-(void)documentInteractionController:(UIDocumentInteractionController *)controller willBeginSendingToApplication:(NSString *)application
{

}

- (void)documentInteractionController:(UIDocumentInteractionController *)controller didEndSendingToApplication:(NSString *)application
{

}

- (void)documentInteractionControllerDidDismissOpenInMenu:(UIDocumentInteractionController *)controller
{

}
0

, URL-, .

:

[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"http://www.apple.com"]];

, , HTTP/html-, . iBooks url, , , .

[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"ebook://iRobot.pdf"]];

NOTE: this is not true, just to illustrate another URL scheme.

-1
source

Source: https://habr.com/ru/post/1757062/


All Articles