我配置了我的应用程序可以打开具有特定扩展名的文件(以下示例中的SFL)。当我尝试从邮件应用程序或其他应用程序中的电子邮件附件打开文件时,它运行良好。但是,如果我尝试从Safari打开它不起作用(例如,从谷歌驱动器网站)。该文件将作为文本文件在浏览器中自动打开。如何在我的应用程序中打开文件?
用于打开mime类型为“plain / text”和“gwe”扩展名的文件,例如“myfile.gwe”
在您的info.plist中:
<key>CFBundleDocumentTypes</key>
<array>
<dict>
<key>CFBundleTypeIconFiles</key>
<array/>
<key>CFBundleTypeName</key>
<string>public.gwe</string>
<key>LSItemContentTypes</key>
<array>
<string>public.gwe</string>
</array>
</dict>
</array>
<key>UTExportedTypeDeclarations</key>
<array>
<dict>
<key>UTTypeConformsTo</key>
<array>
<string>public.text</string>
</array>
<key>UTTypeDescription</key>
<string>gwe custom file</string>
<key>UTTypeIdentifier</key>
<string>public.gwe</string>
<key>UTTypeTagSpecification</key>
<dict>
<key>public.filename-extension</key>
<array>
<string>gwe</string>
</array>
</dict>
</dict>
</array>