将DB3与Xamarin Forms应用程序相关联

时间:2017-12-06 18:15:00

标签: ios sqlite file xamarin.forms info.plist

我将.db3文件与我的Xamarin Forms应用程序的iOS项目关联起来有些困难。理想情况下,我希望用户单击.db3的文件类型并打开我的应用程序。 我编辑了Info.plist以包含:

<key>CFBundleDocumentTypes</key>
  <array>
    <dict>
      <key>CFBundleTypeIconFiles</key>
      <array>
        <string>**********.png</string>
      </array>
      <key>CFBundleTypeName</key>
      <string>*******</string>
      <key>CFBundleTypeRole</key>
      <string>Viewer</string>
      <key>LSHandlerRank</key>
      <string>Alternate</string>
      <key>LSItemContentTypes</key>
      <array>
        <string>public.db3</string>
      </array>
    </dict>
  </array>

我不确定我的代码在哪里出错,任何帮助都会受到赞赏。

1 个答案:

答案 0 :(得分:0)

原来这是一个解决方案:

<key>CFBundleDocumentTypes</key>
  <array>
    <dict>
      <key>CFBundleTypeIconFile</key>
      <string>any.png</string>
      <key>LSItemContentTypes</key>
      <array>
        <string>com.proj.name.db3</string>
      </array>
      <key>CFBundleTypeName</key>
      <string>DB3 Custom data type</string>
      <key>LSHandlerRank</key>
      <string>Owner</string>
    </dict>
  </array>

  <key>UTExportedTypeDeclarations</key>
  <array>
    <dict>
      <key>UTTypeDescription</key>
      <string>Database file import and export</string>
      <key>UTTypeConformsTo</key>
      <array>
        <string>public.text</string>
      </array>
      <key>UTTypeIdentifier</key>
      <string>com.proj.name.db3</string>
      <key>UTTypeTagSpecification</key>
      <dict>
        <key>public.filename-extension</key>
        <string>db3</string>
      </dict>
    </dict>
  </array>