2017-06-26 56 views
1

私のアプリでiCloudドライブから.objファイルを開くと、UIDocumentPickerViewControllerがスローされています。私は.objファイルのためのstandart UTiを見つけることができませんでした。したがって、このhttps://developer.apple.com/library/content/qa/qa1587/_index.htmlを使用して、このファイル拡張子のサポートを私のアプリケーションに追加しようとします。UIDカスタムUTI in UIDocumentPickerViewController initWithDocumentTypes

Info.plistのセクションがあります:

<key>CFBundleDocumentTypes</key> 
<array> 
    <dict> 
     <key>CFBundleTypeIconFiles</key> 
     <array> 
      <string>arrow1</string> 
     </array> 
     <key>CFBundleTypeName</key> 
     <string>OBJ model</string> 
     <key>CFBundleTypeRole</key> 
     <string>Editor</string> 
     <key>LSHandlerRank</key> 
     <string>Owner</string> 
     <key>LSItemContentTypes</key> 
     <array> 
      <string>com.giena.Interface.obj</string> 
     </array> 
    </dict> 
</array> 

<key>UTExportedTypeDeclarations</key> 
<array> 
    <dict> 
     <key>UTTypeConformsTo</key> 
     <array> 
      <string>public.data</string> 
     </array> 
     <key>UTTypeDescription</key> 
     <string>OBJ model</string> 
     <key>UTTypeIdentifier</key> 
     <string>com.giena.Interface.obj</string> 
     <key>UTTypeSize320IconFile</key> 
     <string>arrow1</string> 
     <key>UTTypeSize64IconFile</key> 
     <string>arrow1</string> 
     <key>UTTypeTagSpecification</key> 
     <dict> 
      <key>public.filename-extension</key> 
      <array> 
       <string>obj</string> 
      </array> 
     </dict> 
    </dict> 
</array> 

はとUIDocumentPickerViewControllerコールがあります:

UIDocumentPickerViewController *documentPicker = [[UIDocumentPickerViewController alloc] initWithDocumentTypes:@[@"public.text"]  inMode:UIDocumentPickerModeOpen]; 
    documentPicker.delegate = self; 
    documentPicker.modalPresentationStyle = UIModalPresentationFormSheet; 
    [self presentViewController:documentPicker animated:YES completion:nil]; 

私はアプリを実行しているとき、私はファイル選択するためのポップアップ表示を参照してください、しかし、.OBJファイルがされグレーで選択できません。何が間違っているのですか?

+0

それはバグのように見えます...今日、私は.tstと.xxxxとその仮想ファイル拡張子を持つ、このアクションを実行しよううまく動作します。しかし、.objの拡張子で私は問題があります。 – Giena

+0

.objファイルを選択しようとしていますが、文書タイプに "public.text"と記載されています。これを解決すれば、カスタム拡張の正確さを教えてください。 –

答えて

0

あなたは、ドキュメントタイプのリストにカスタムUTIを使用する必要があります。

UIDocumentPickerViewController *documentPicker =[[UIDocumentPickerViewController alloc] initWithDocumentTypes:@[@"com.giena.Interface.obj"] inMode:UIDocumentPickerModeOpen]; 
関連する問題