Import GPX File Works on iPad but not on iPhone

I am adding a feature to my app to import a GPX file using the Document Picker.

For some reason, this feature works just fine testing on my iPad but not my iPhone. All GPX files are disabled (lower opacity) on my iPhone so I can't select them. On my iPad, I can select these files with no issues. Both iPad and iPhone are on iOS v17.5.1. My iPhone is a 14 Pro Max and my iPad is an iPad Pro (10.5 inch) model.

Here is my Info.plist file as well as my Entitlements.plist

Let me know if you need any other information.

Info.plist

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
    <dict>
        <key>LSRequiresIPhoneOS</key>
        <true />
        <key>UIDeviceFamily</key>
        <array>
            <integer>1</integer>
            <integer>2</integer>
        </array>
        <key>UIRequiredDeviceCapabilities</key>
        <array>
            <string>arm64</string>
        </array>
        <key>UISupportedInterfaceOrientations</key>
        <array>
            <string>UIInterfaceOrientationPortrait</string>
            <string>UIInterfaceOrientationLandscapeLeft</string>
            <string>UIInterfaceOrientationLandscapeRight</string>
        </array>
        <key>UISupportedInterfaceOrientations~ipad</key>
        <array>
            <string>UIInterfaceOrientationPortrait</string>
            <string>UIInterfaceOrientationPortraitUpsideDown</string>
            <string>UIInterfaceOrientationLandscapeLeft</string>
            <string>UIInterfaceOrientationLandscapeRight</string>
        </array>
        <key>XSAppIconAssets</key>
        <string>Assets.xcassets/appicon.appiconset</string>
        <key>CFBundleIdentifier</key>
        <string />
        <key>NSLocationWhenInUseUsageDescription</key>
        <string>Location is used to track your location while navigating routes and waypoints.</string>
        <key>CFBundleShortVersionString</key>
        <string>2.8.0</string>
        <key>CFBundleDisplayName</key>
        <string>Fish Fathom</string>
        <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>
        <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>
        <key>LSSupportsOpeningDocumentsInPlace</key>
        <true />
    </dict>
</plist>

Entitlements.plist

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
    <dict>
        <key>com.apple.developer.applesignin</key>
        <array>
            <string>Default</string>
        </array>
        <key>com.apple.developer.icloud-services</key>
        <array>
            <string>CloudDocuments</string>
        </array>
    </dict>
</plist>

It's important that all apps that use GPX files use the same UTI definition. If they don't, issues like this can occur. My guess is that on one of your devices you have an existing GPX-supporting app with a slightly different UTI definition and on the other you don't.

http://www.topografix.com/GPX/1/1

That's the XML namespace URL, which is not what you want. The recommended UTI reference URL is:

https://www.topografix.com/gpx.asp

You should probably also change the UTTypeConformsTo to public.data, though I believe this is not critical.

If you search the forum you might find old threads where this was discussed. I believe it was first a problem in the iOS 13 era.

I have applied the changes as you have recommended but the other app still seems to "override" my app. Any suggestions on how to overcome this challenge?

I don't think it's fixable. "File a bug" ha ha ha ha ha ha ha ROFL.

It's worth checking exactly how this other app has defined its UTI. This is difficult, unless it is installable on your Mac; in that case you should be able to inspect its info.plist.

FYI here is an Apple-recommended UTI for GPX, supplied to me by DTS in 2019:

<key>UTImportedTypeDeclarations</key>
<array>
<dict>
<key>UTTypeIdentifier</key>
<string>com.topografix.gpx</string>
<key>UTTypeReferenceURL</key>
<string>https://www.topografix.com/gpx.asp</string>
<key>UTTypeConformsTo</key>
<array>
<string>public.data</string>
</array>
<key>UTTypeTagSpecification</key>
<dict>
<key>public.filename-extension</key>
<array>
<string>gpx</string>
</array>
</dict>
</dict>
</array>

I asked about the lack of a MIME section; they said that adding that would "not affect the comparison of the two types", which I took to mean that it is safe to add.

Import GPX File Works on iPad but not on iPhone
 
 
Q