如何让我的应用程序显示在“打开方式...”菜单中。加速器
How do I get my application to show up in the Open in... menu. Appcelerator
我想做与在 apple 文档中解释这篇文章相同的事情,但在 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() || []
将为您提供其中所有文档的数组,然后您可以将其移出该目录,或处理并删除。
我想做与在 apple 文档中解释这篇文章相同的事情,但在 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() || []
将为您提供其中所有文档的数组,然后您可以将其移出该目录,或处理并删除。