我有UIDocumentPickerViewController
以下代码:
UIDocumentPickerViewController *documentPicker =
[[UIDocumentPickerViewController alloc] initWithDocumentTypes: @[@"public.text", @"public.sql"]
inMode: UIDocumentPickerModeOpen];
documentPicker.delegate = self;
documentPicker.modalPresentationStyle = UIModalPresentationOverFullScreen;
[self presentViewController: documentPicker
animated: YES
completion: nil];
这会打开选择器,我可以选择 .txt 文件,但不能选择 .sql 文件。以下屏幕截图显示了 .sql 文件在选取器中的外观。
我已将以下内容添加到我的info.plist
文件中,据我了解可能需要这些内容(忽略 UTTypeReferenceURL,我只是想让它工作。)
<key>UTExportedTypeDeclarations</key>
<array>
<dict>
<key>UTTypeConformsTo</key>
<array>
<string>public.sql</string>
<string>public.data</string>
</array>
<key>UTTypeDescription</key>
<string>SQL statement(s)</string>
<key>UTTypeIconFile</key>
<string>public.sql</string>
<key>UTTypeIdentifier</key>
<string>public.sql</string>
<key>UTTypeReferenceURL</key>
<string>http://www.w3.org/Graphics/JPEG/</string>
</dict>
</array>
我需要做什么才能UIDocumentPickerViewController
允许选择 .sql 文件类型?