質問

Is it possible to open an .ibooks file within my documents directory automatically, without any UIDocumentInteractionController? Maybe by manipulating the url or something like this?

I tried opening it via shared application but it didn't work well:

NSString *filePath = [self.serviceMedia pathToIbook];
NSURL *url = [NSURL filePath];
[[UIApplication sharedApplication] openURL:url];

BTW: The url is valid and not nil and starting with "file://var..."

Thanks in advance!

役に立ちましたか?

解決

iBooks has an undocumented URL scheme of ibooks. This means you can launch iBooks with a URL like [NSURL URLWithString:@"ibooks://"].

However, there is no documentation on how to pass a specific file to this URL. So basically, there is no documented way to do what you are asking.

Despite your requirement, UIDocumentInteractionController is the correct way to do this. It is the way Apple wants you to do it. Plus, using UIDocumentInteractionController has the benefit of letting the user decide what to do with the file.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top