アプリに PDF があります。Stanza や iBooks など、デバイスにインストールされている可能性のある他のサードパーティの電子書籍リーダー アプリでそれらの PDF を開くオプションを提供したいと考えています。Dropbox アプリケーションはこの機能を正常に実装しましたが、デバイスで利用できる他の電子書籍リーダーや、それらのアプリのカスタム URL スキームを検出する方法に関する情報が見つかりません。どんな助けでも大歓迎です。よろしくお願いします。
10344 次
3 に答える
2
iBook
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];
于 2011-06-10T14:51:03.227 に答える
0
まず、次のように 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
{
}
于 2012-06-28T10:39:33.177 に答える
-1
他のアプリを検出する必要はありません。それらを開くことができる URL を知る必要があります。
このような呼び出し:
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"http://www.apple.com"]];
サファリである http/html リクエストを処理するアプリでページを開くように電話に指示します。iBooks には、追跡できる独自の URL 形式があります。
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"ebook://iRobot.pdf"]];
注: これは正しくありません。別の URL スキームを説明するためのものです。
于 2010-07-29T02:16:59.640 に答える