【发布时间】:2019-10-12 18:32:19
【问题描述】:
我正在使用 UIDocumentPickerViewController 来挑选文档。以下是指定的尿路感染:
NSArray *types = @[(NSString*)kUTTypeImage,(NSString*)kUTTypeSpreadsheet,(NSString*)kUTTypePresentation,(NSString*)kUTTypePDF,(NSString*)kUTTypeRTF,(NSString*)kUTTypePlainText,(NSString*)kUTTypeText];
UIDocumentPickerViewController *dpvc = [[UIDocumentPickerViewController alloc] initWithDocumentTypes:types inMode:UIDocumentPickerModeImport];
从 pages 应用程序创建的文件(页面文件)显示为灰色,无法选择。但是 WhatsApp 文档选择器允许选择相同的文件。我是否缺少任何必需的尿路感染?
我的应用:
WhatsApp:
更新
com.apple.iwork.pages.sffpages 对我设备上的页面文件有效,但对 icloud 驱动器上的文件无效。呈现文档选择器的完整代码是:
-(IBAction)showDocumentPicker:(id)sender
{
NSArray *types = @[(NSString*)kUTTypeImage,(NSString*)kUTTypeSpreadsheet,(NSString*)kUTTypePresentation,(NSString*)kUTTypePDF,(NSString*)kUTTypeRTF,(NSString*)kUTTypePlainText,(NSString*)kUTTypeText, @"com.apple.iwork.pages.sffpages"];
UIDocumentPickerViewController *dpvc = [[UIDocumentPickerViewController alloc] initWithDocumentTypes:types inMode:UIDocumentPickerModeImport];
dpvc.delegate = self;
//colorFromHex 4285f4
[[UINavigationBar appearance] setTintColor:[UIColor colorWithRed:66.0/255.0 green:133.0/255.0 blue:244.0/255.0 alpha:1.0]];
[self presentViewController:dpvc animated:YES completion:nil];
}
【问题讨论】:
-
据我了解,您需要所有复合内容格式,这些都是 kUTTypePDF、kUTTypeRTFD、kUTTypeFlatRTFD、kUTTypeTXNTextAndMultimediaData、kUTTypeWebArchive。
-
@m1sh0 谢谢,但这些都不起作用:(
-
你试过这些“com.apple.iwork.pages.pages”、“com.apple.iwork.numbers.numbers”、“com.apple.iwork.keynote.key”吗? ??
-
@m1sh0 是的,试过之后发了一个问题。
-
@m1sh0 在指定这些 UTI 后,我必须清理构建。感谢您的宝贵时间。
标签: ios objective-c file uidocumentpickerviewcontroller