4

ドキュメントの選択に UIDocumentPickerViewController を使用しています。以下は、指定された UTI です。

NSArray *types = @[(NSString*)kUTTypeImage,(NSString*)kUTTypeSpreadsheet,(NSString*)kUTTypePresentation,(NSString*)kUTTypePDF,(NSString*)kUTTypeRTF,(NSString*)kUTTypePlainText,(NSString*)kUTTypeText];

UIDocumentPickerViewController *dpvc = [[UIDocumentPickerViewController alloc] initWithDocumentTypes:types inMode:UIDocumentPickerModeImport];

ページ アプリから作成されたファイル (ページ ファイル) はグレー表示され、選択できません。しかし、WhatsApp ドキュメント ピッカーは同じファイルを選択することができました。必要な UTI がありませんか?

私のアプリ:

ここに画像の説明を入力

ワッツアップ:

ここに画像の説明を入力

アップデート

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];
}
4

1 に答える 1