是否将PDF文件保存在其他应用程序可以访问的PhoneGap应用程序中?(iOS)

Save PDF file in PhoneGap Application that is Accessable by other Apps? (iOS)

本文关键字:应用程序 PhoneGap iOS 访问 文件 PDF 保存 存在 是否 其他      更新时间:2024-02-26

我有一个PhoneGap应用程序(iOS)。

我有PDF数据,我想保存到本地文件系统。我正在使用以下代码:

                var gotFS = function( fileSystem ) {
                    fileSystem.root.getFile( "test.pdf", { create: true, exclusive: false }, gotFileEntry, fail );
                };
                var gotFileEntry = function( fileEntry ) {
                    fileEntry.createWriter( gotFileWriter, fail );
                };
                var gotFileWriter = function( writer ) {
                    writer.write( pdf );
                };
                var fail = function( error ) {
                    console.log( error.code );
                };
                window.requestFileSystem( LocalFileSystem.PERSISTENT, 0, gotFS, fail );

这是可行的,但是PDF文件只能通过我自己的应用程序访问。

我真正想要的是将PDF文档保存到文件系统中,以便其他读取PDF的iOS应用程序可以访问它。这可能吗?如果是,我该怎么做?

(提前)感谢你的帮助。

这是可能的,但只是在iOS 8和更高版本上,但事实是,我找不到任何关于如何做到这一点的信息,我只找到了关于如何从其他应用程序获取文件的信息:

https://developer.apple.com/library/ios/documentation/FileManagement/Conceptual/DocumentPickerProgrammingGuide/AccessingDocuments/AccessingDocuments.html

还有另一个选项,"打开方式",允许您的应用程序启动"打开方式"对话框,显示可以打开文件的应用程序。你有一些插件https://github.com/pwlin/cordova-plugin-file-opener2