2 Replies
      Latest reply on Mar 16, 2019 3:56 PM by AdvKern
      giena Level 1 Level 1 (0 points)

        I am trying to open .obj files from iCloud Drive in my app through UIDocumentPickerViewController. I could't find standart UTi for .obj files. So, using this https://developer.apple.com/library/content/qa/qa1587/_index.html , I try to add support of this file-extension for my app. I tested 3 types of file extensions: real - .obj and virtual .tst and .xxxx which are simply txt files with file-extension changed by hand.

         

        Result is strange. Files with .xxxx and .tst extensions are accessed and i can select it. But .obj files are gray and not accessed. What am i doing wrong?

         

        There is info.plist sections

         

        <key>CFBundleDocumentTypes</key>
          <array>
          <dict>
          <key>CFBundleTypeIconFiles</key>
          <array>
          <string>btn1</string>
          </array>
          <key>CFBundleTypeName</key>
          <string>TST model</string>
          <key>CFBundleTypeRole</key>
          <string>Viewer</string>
          <key>LSHandlerRank</key>
          <string>Default</string>
          <key>LSItemContentTypes</key>
          <array>
          <string>com.giena.Interface.tst</string>
          </array>
          </dict>
          <dict>
          <key>CFBundleTypeIconFiles</key>
          <array>
          <string>btn1</string>
          </array>
          <key>CFBundleTypeName</key>
          <string>XXXX model</string>
          <key>CFBundleTypeRole</key>
          <string>Viewer</string>
          <key>LSHandlerRank</key>
          <string>Default</string>
          <key>LSItemContentTypes</key>
          <array>
          <string>com.giena.Interface.xxxx</string>
          </array>
          </dict>
          <dict>
          <key>CFBundleTypeIconFiles</key>
          <array>
          <string>arrow1</string>
          </array>
          <key>CFBundleTypeName</key>
          <string>OBJ model</string>
          <key>CFBundleTypeRole</key>
          <string>Viewer</string>
          <key>LSHandlerRank</key>
          <string>Default</string>
          <key>LSItemContentTypes</key>
          <array>
          <string>com.giena.Interface.obj</string>
          </array>
          </dict>
          </array>
        
        
        

         

        <key>UTImportedTypeDeclarations</key>
          <array>
          <dict>
          <key>UTTypeConformsTo</key>
          <array>
          <string>public.data</string>
          </array>
          <key>UTTypeDescription</key>
          <string>TST model</string>
          <key>UTTypeIdentifier</key>
          <string>com.giena.Interface.tst</string>
          <key>UTTypeSize320IconFile</key>
          <string>btn1</string>
          <key>UTTypeSize64IconFile</key>
          <string>btn1</string>
          <key>UTTypeTagSpecification</key>
          <dict>
          <key>public.filename-extension</key>
          <array>
          <string>tst</string>
          </array>
          </dict>
          </dict>
          <dict>
          <key>UTTypeConformsTo</key>
          <array>
          <string>public.data</string>
          </array>
          <key>UTTypeDescription</key>
          <string>XXXX Model</string>
          <key>UTTypeIdentifier</key>
          <string>com.giena.Interface.xxxx</string>
          <key>UTTypeSize320IconFile</key>
          <string>btn1</string>
          <key>UTTypeSize64IconFile</key>
          <string>btn1</string>
          <key>UTTypeTagSpecification</key>
          <dict>
          <key>public.filename-extension</key>
          <array>
          <string>xxxx</string>
          </array>
          </dict>
          </dict>
          <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>
        
        
        

         

         

        and there is UIDocumentPickerViewController call

         

        UIDocumentPickerViewController *documentPicker = [[UIDocumentPickerViewController alloc] initWithDocumentTypes:@[@"com.giena.Interface.tst",@"com.giena.Interface.xxxx",@"com.giena.Interface.obj"] inMode:UIDocumentPickerModeOpen];
                documentPicker.delegate = self;
                documentPicker.modalPresentationStyle = UIModalPresentationFormSheet;
                [self presentViewController:documentPicker animated:YES completion:nil];
        
        
        

         

         

        P. S How to post images here?