IOS及Android文件类型关联的Delphi示例

Android要匹配任意扩展名,注意要改成

  1. <intent-filter>
  2. <action android:name="android.intent.action.VIEW"></action>
  3. <category android:name="android.intent.category.DEFAULT"></category>
  4. <data android:mimeType="*/*"></data>
  5. </intent-filter>
  6. 如果你想关联发送共享之类的,可以加上
  7. <intent-filter>
  8. <action android:name="android.intent.action.SEND" />
  9. <category android:name="android.intent.category.DEFAULT" />
  10. <data android:mimeType="*/*" />
  11. </intent-filter>

ios下关联任意文件,要改成

  1. <key>CFBundleDocumentTypes</key>
  2. <array>
  3. <dict>
  4. <key>CFBundleTypeName</key>
  5. <string>com.myapp.common-data</string>
  6. <key>LSItemContentTypes</key>
  7. <array>
  8. <string>com.microsoft.powerpoint.ppt</string>
  9. <string>public.item</string>
  10. <string>com.microsoft.word.doc</string>
  11. <string>com.adobe.pdf</string>
  12. <string>com.microsoft.excel.xls</string>
  13. <string>public.image</string>
  14. <string>public.content</string>
  15. <string>public.composite-content</string>
  16. <string>public.archive</string>
  17. <string>public.audio</string>
  18. <string>public.movie</string>
  19. <string>public.text</string>
  20. <string>public.data</string>
  21. </array>
  22. </dict>
  23. </array>

附件大小
FileAssoc.zip18.38 KB
LinkFile.zip12.5 KB