ios - 如何让我的应用程序显示在“打开于...”菜单中。加速器

标签 ios types titanium appcelerator document

我想做与苹果文档中解释本文相同的事情,但在 Appcelerator Titanium 中。我搜遍了Appcelerator网站,没有找到方法。有谁知道吗? https://developer.apple.com/library/content/qa/qa1587/_index.html

最佳答案

您需要在 tiapp.xml 中注册您希望能够处理的文件。 :

<?xml version="1.0" encoding="UTF-8"?>
<ti:app xmlns:ti="http://ti.appcelerator.org">
    <ios>
        <plist>
            <dict>
                <key>CFBundleDocumentTypes</key>
                <array>
                    <dict>
                        <key>CFBundleTypeName</key>
                        <string>Add to Housters</string>
                        <key>CFBundleTypeRole</key>
                        <string>Viewer</string>
                        <key>LSHandlerRank</key>
                        <string>Owner</string>
                        <key>LSItemContentTypes</key>
                        <array>
                            <string>com.adobe.pdf</string>
                            <string>com.microsoft.word.doc</string>
                        </array>
                    </dict>
                </array>
            </dict>
        </plist>
    </ios>
</ti:app>

然后,在您的应用程序代码中,每次 resume事件被触发(例如 Ti.App.addEventListener('resume', resume); ),您可以查看 Ti.App.getArguments().url查看您的应用程序是否已通过其他应用程序打开。在我的应用程序中,我这样做,并且扫描 Inbox文件夹看看有没有东西。当另一个应用程序在您的应用程序中打开文档时,它将被复制到此目录中,然后启动您的应用程序。所以Ti.Filesystem.getFile(Ti.Filesystem.applicationDataDirectory, 'Inbox').getDirectoryListing() || []将为您提供其中所有文档的数组,然后您可以将其移出该目录,或处理和删除。

关于ios - 如何让我的应用程序显示在“打开于...”菜单中。加速器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44758681/

相关文章:

ios - 如何显示时间 08 :00:00 to 8 am using swift

java - 如何修改 void 类方法使其返回所需信息

ios - Xcode 7.3 的 WCSession 问题

ios - 无法将字符串从 Firebase 数据库闭包 block 快速传递给公共(public)变量

c - 在不使用 union 的情况下,如何在 C 中将 64 个字节的数组视为 16 个整数的数组(反之亦然)?

types - Julia 中的值类型实例

javascript - 从变量动态创建命名空间对象

ios - 适用于 IOS 应用程序的 Titanium appcelerator 中广播接收器的替代方案

ios - 为什么从 firebase 注销用户需要错误处理,而不是获取当前用户?