I'm developing an iOS app that needs to read .pgw files (https://en.wikipedia.org/wiki/World_file) from the local device storage. I have a sample file on my device that I'm trying to open from within the app. When I open the document picker, I can see the file but it's greyed out and I can't select it. In that screenshot, malaysia-google-earth.pgw is the file I'm trying to open.
If I change the file extension of that file to .txt, it's no longer greyed out and I can select it. So I know it's a problem with the file extension.
I've tried to add .pgw to the supported document types list for the app, but since there is no Uniform Type Identifier for this extension, I'm not sure if I'm adding it correctly. My Info.plist file includes these keys:
<key>CFBundleDocumentTypes</key>
<array>
<dict>
<key>CFBundleTypeIconFiles</key>
<array/>
<key>CFBundleTypeName</key>
<string>PNG World File</string>
<key>CFBundleTypeRole</key>
<string>Editor</string>
<key>LSHandlerRank</key>
<string>Alternate</string>
<key>LSItemContentTypes</key>
<array>
<string>public.pgw</string>
</array>
</dict>
</array>
<key>LSSupportsOpeningDocumentsInPlace</key>
<true/>
<key>UIFileSharingEnabled</key>
<key>UTExportedTypeDeclarations</key>
<array>
<dict>
<key>UTTypeConformsTo</key>
<array>
<string>public.data</string>
</array>
<key>UTTypeDescription</key>
<string>PNG World File</string>
<key>UTTypeIconFiles</key>
<array/>
<key>UTTypeIdentifier</key>
<string>public.pgw</string>
<key>UTTypeTagSpecification</key>
<dict>
<key>public.filename-extension</key>
<array>
<string>pgw</string>
</array>
</dict>
</dict>
</array>
<true/>
I am using iOS version 13.6, and this is a React Native app using react-native-document-picker.
Related
I've tried to associate my app with a custom file extension, and it's showing up in the share sheet when the user tries to share that file with my app from another app.
But the problem is that my app is showing up as 6th or 7th app in the share sheet.
The extension is a custom file extension defined by my app. How can I make my app show up as the first app in the share sheet for this specific file extension?
This is how I made my app associate with that file extension.
<key>CFBundleDocumentTypes</key>
<array>
<dict>
<key>CFBundleTypeName</key>
<string>custom file</string>
<key>LSHandlerRank</key>
<string>Owner</string>
<key>LSItemContentTypes</key>
<array>
<string>my.package.name.customextension</string>
</array>
</dict>
</array>
<key>UTExportedTypeDeclarations</key>
<array>
<dict>
<key>UTTypeConformsTo</key>
<array>
<string>public.archive</string>
<string>public.data</string>
</array>
<key>UTTypeDescription</key>
<string>custom File</string>
<key>UTTypeIdentifier</key>
<string>my.package.name.customextension</string>
<key>UTTypeTagSpecification</key>
<dict>
<key>public.filename-extension</key>
<array>
<string>customextension</string>
</array>
<key>public.mime-type</key>
<string>application/customextension</string>
</dict>
</dict>
</array>
I've created a new file type unique to my App. A user can now save, for the purpose of sharing, backup etc., files of this type to the App's own folder on iCloud Drive.
This feature is now live on the app store and works with one, odd, exception.
If I tap on my new file type, anywhere in iCloud Drive except the App's own folder, my App appears as an option in "Copy to ..."
I'd prefer if it just opened it which might be part of the problem.
If I tap on a file in it's own folder the App is not listed in "Copy to ...".
If I add the file to a website it can open it fine from there too.
It can create new files in it's own folder no problem.
What am I missing?
<key>CFBundleDocumentTypes</key>
<array>
<dict>
<key>CFBundleTypeIconFiles</key>
<array>
<string>CSL-icon-64x64.png</string>
<string>CSL-icon-44x58.png</string>
<string>CSL-icon-22x29.png</string>
<string>CSL-icon-320x320.png</string>
</array>
<key>CFBundleTypeName</key>
<string>CSL File Type</string>
<key>CFBundleTypeRole</key>
<string>Editor</string>
<key>LSHandlerRank</key>
<string>Owner</string>
<key>LSItemContentTypes</key>
<array>
<string>com.mydomain.csl</string>
</array>
</dict>
</array>
<key>UTExportedTypeDeclarations</key>
<array>
<dict>
<key>UTTypeConformsTo</key>
<array>
<string>public.data</string>
</array>
<key>UTTypeDescription</key>
<string>CSL File Type</string>
<key>UTTypeIdentifier</key>
<string>com.mydomain.csl</string>
<key>UTTypeSize320IconFile</key>
<string>CSL-icon-320x320</string>
<key>UTTypeSize64IconFile</key>
<string>CSL-icon-64x64</string>
<key>UTTypeTagSpecification</key>
<dict>
<key>public.filename-extension</key>
<array>
<string>csl</string>
</array>
<key>public.mime-type</key>
<string>application/something</string>
</dict>
</dict>
</array>
<key>UTImportedTypeDeclarations</key>
<array>
<dict>
<key>UTTypeConformsTo</key>
<array>
<string>public.data</string>
</array>
<key>UTTypeDescription</key>
<string>CSL File Type</string>
<key>UTTypeIdentifier</key>
<string>com.mydomain.csl</string>
<key>UTTypeSize320IconFile</key>
<string>CSL-icon-320x320</string>
<key>UTTypeSize64IconFile</key>
<string>CSL-icon-64x64</string>
<key>UTTypeTagSpecification</key>
<dict>
<key>public.filename-extension</key>
<array>
<string>csl</string>
</array>
<key>public.mime-type</key>
<string>application/something</string>
</dict>
</dict>
</array>
<key>NSUbiquitousContainers</key>
<dict>
<key>iCloud.com.mydomain.myapp</key>
<dict>
<key>NSUbiquitousContainerIsDocumentScopePublic</key>
<true/>
<key>NSUbiquitousContainerName</key>
<string>SomeDirName</string>
<key>NSUbiquitousContainerSupportedFolderLevels</key>
<string>Any</string>
</dict>
</dict>
This is an anonymised version of the meta taken from my App's info.plist file, not an exact copy.
I'm trying to define a GPX document type so that I can open gpx file types from other applications. I've followed Apple's Technical Q&A on this topic.
I've also tried solutions that I found that edited the plist file directly. None of them have worked. I still don't see my application in the "Open In" menu when I try to open a gpx file. I'm pretty sure I'm missing something here. I just don't have any idea what it is. Please help.
<key>UTImportedTypeDeclarations</key>
<array>
<dict>
<key>UTTypeConformsTo</key>
<array>
<string>public.xml</string>
</array>
<key>UTTypeDescription</key>
<string>GPS Exchange Format (GPX)</string>
<key>UTTypeIdentifier</key>
<string>com.topografix.gpx</string>
<key>UTTypeReferenceURL</key>
<string>http://www.topografix.com/GPX/1/1</string>
<key>UTTypeTagSpecification</key>
<dict>
<key>public.filename-extension</key>
<array>
<string>gpx</string>
</array>
<key>public.mime-type</key>
<string>application/gpx+xml</string>
</dict>
</dict>
</array>
Make sure you define the UTI for GPX in your plist since it is not defined as part of the default iOS UTIs. You can do this by adding the GPX UTI to your target.
Select your Project file
select your target
select "Info"
expand "Import UTIs
Click the + icon
Add the GPX UTI info
You can also edit the plist directly if you want.
Here is what it should look like:
In the plist it will look like this:
<key>UTImportedTypeDeclarations</key>
<array>
<dict>
<key>UTTypeIdentifier</key>
<string>com.topografix.gpx</string>
<key>UTTypeReferenceURL</key>
<string>http://www.topografix.com/GPX/1/1</string>
<key>UTTypeDescription</key>
<string>GPS Exchange Format (GPX)</string>
<key>UTTypeConformsTo</key>
<array>
<string>public.xml</string>
</array>
<key>UTTypeTagSpecification</key>
<dict>
<key>public.filename-extension</key>
<array>
<string>gpx</string>
</array>
<key>public.mime-type</key>
<string>application/gpx+xml</string>
</dict>
</dict>
</array>
Good info on this blog as well...
UPDATE
I assume you already have the document type defined as well in the plist. It should match this:
<key>CFBundleDocumentTypes</key>
<array>
<dict>
<key>CFBundleTypeIconFiles</key>
<array/>
<key>CFBundleTypeName</key>
<string>GPS Exchange Format (GPX)</string>
<key>CFBundleTypeRole</key>
<string>Editor</string>
<key>LSHandlerRank</key>
<string>Owner</string>
<key>LSItemContentTypes</key>
<array>
<string>com.topografix.gpx</string>
</array>
</dict>
</array>
Also implementing CFBundleDocumentTypes to plist allows your app to open when the air drop content conforms to your UTI.
<key>CFBundleDocumentTypes</key>
<array>
<dict>
<key>CFBundleTypeIconFiles</key>
<array/>
<key>CFBundleTypeName</key>
<string>GPX File</string>
<key>LSHandlerRank</key>
<string>Default</string>
<key>LSItemContentTypes</key>
<array>
<string>com.your-Bundle-Idenitifer.gpx</string>
</array>
</dict>
</array>
I've built an app that exports data via email. It takes the data, encodes in an NSData object adds an extension, then attaches it to an email. All of that works perfectly. The issue I'm having is when I open one of those emails, one of the file types I registered works fine. My app appears in the list of target apps and I can import the data with no issues.
For the other file type my app doesn't show up in the list of target apps. For both types, I've created entries in info.plist for Document Type, and for each type I've created a custom UTI with file extension.
I've looked at the configuration for both and the only differences I can see are the UTI I'm using, the extension for the UTI and the name of the document.
Am I missing something?
Relevant portions of info.plist:
<key>CFBundleDocumentTypes</key>
<array>
<dict>
<key>CFBundleTypeIconFiles</key>
<array>
<string>appname144</string>
</array>
<key>CFBundleTypeName</key>
<string>appname Army Archive</string>
<key>LSHandlerRank</key>
<string>Owner</string>
<key>LSItemContentTypes</key>
<array>
<string>com.appnameeapp.archive.army</string>
</array>
</dict>
<dict>
<key>CFBundleTypeIconFiles</key>
<array>
<string>appname144</string>
</array>
<key>CFBundleTypeName</key>
<string>appname List Archive</string>
<key>LSHandlerRank</key>
<string>Owner</string>
<key>LSItemContentTypes</key>
<array>
<string>com.appnameapp.archive.list</string>
</array>
</dict>
</array>
<key>UTExportedTypeDeclarations</key>
<array>
<dict>
<key>UTTypeConformsTo</key>
<array>
<string>public.data</string>
</array>
<key>UTTypeDescription</key>
<string>appname Army</string>
<key>UTTypeIdentifier</key>
<string>com.appnameapp.archive.army</string>
<key>UTTypeTagSpecification</key>
<dict>
<key>puclic.filename-extension</key>
<string>wfarmy</string>
</dict>
</dict>
<dict>
<key>UTTypeConformsTo</key>
<array>
<string>public.data</string>
</array>
<key>UTTypeDescription</key>
<string>appname List</string>
<key>UTTypeIdentifier</key>
<string>com.appnameapp.archive.list</string>
<key>UTTypeTagSpecification</key>
<dict>
<key>public.filename-extension</key>
<string>wflist</string>
</dict>
</dict>
</array>
I have associated a filetype with my iOS app, which works fine. However I want the file type to be exclusive, so that other applications do not offer to 'open in' my file.
I have an app by another developer that does this, but I can't work out how it is done. I have extracted the plist for this app and I cannot see what it is doing to make this happen.
This is what I want to do :
This is what happens in my App:
This is how I have the file associations setup in my plist:
<key>CFBundleDocumentTypes</key>
<array>
<dict>
<key>CFBundleTypeExtensions</key>
<array>
<string>abcd</string>
</array>
<key>CFBundleTypeName</key>
<string>My File</string>
<key>LSHandlerRank</key>
<string>Owner</string>
<key>LSItemContentTypes</key>
<array>
<string>com.myapp.abcd</string>
</array>
</dict>
</array>
<key>UTExportedTypeDeclarations</key>
<array>
<dict>
<key>UTTypeConformsTo</key>
<array>
<string>com.myapp.abcd</string>
</array>
<key>UTTypeDescription</key>
<string>My File</string>
<key>UTTypeIconFile</key>
<string>icon</string>
<key>UTTypeIdentifier</key>
<string>com.myapp.abcd</string>
<key>UTTypeTagSpecification</key>
<dict>
<key>public.filename-extension</key>
<array>
<string>abcd</string>
</array>
</dict>
</dict>
</array>
What am I missing?? Does anyone know how to enable this functionality?
Thanks
Duncan