MobileApplication.HandleURL not obvious

Greg,
Well I did as recommended and added the plist entries for the file. Now I’m getting the error below in Transporter. I have no idea which entry…
It did work just fine in the debugger though.

ERROR ITMS-90079: “This bundle is invalid. The application executable contains an embedded __INFO_PLIST section, which is not allowed for iOS applications.”

I also had to add line into the plist “Supports opening documents in place”, and “Supports Document Browser”. Is it possible to set some flags in Xojo to do that during the build process?

This is brilliant and will make my app so much better. Thanks Greg and Chris!

I, too ran into the missing LSSupportsOpeningDocumentsInPlace and UISupportsDocumentBrowser keys warning. But where do those go, hierarchically? Are they a separate dictionary under the CFBundleDocumentTypes array of dictionaries?

Never mind, I figured out the answer to my own question. Using Greg’s code from above, you add it after the last close array angle brackets. My app uploaded to the app store without any problems this way.

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist SYSTEM "file://localhost/System/Library/DTDs/PropertyList.dtd">
<plist version="0.9">
<dict>
   <key>CFBundleDocumentTypes</key>
   <array>
      <dict>
         <key>CFBundleTypeName</key>
         <string>JPEGimage</string>
         <key>CFBundleTypeExtensions</key>
         <array>
            <string>jpg</string>
         </array>
         <key>LSItemContentTypes</key>
         <array>
            <string>public.jpeg</string>
         </array>
         <key>CFBundleTypeRole</key>
         <string>Editor</string>
         <key>LSHandlerRank</key>
         <string>Default</string>
      </dict>
   </array>

   <key>UTImportedTypeDeclarations</key>
   <array>
      <dict>
         <key>UTTypeIdentifier</key>
         <string>public.jpeg</string>
         <key>UTTypeConformsTo</key>
         <array>
            <string>public.image</string>
            <string>public.data</string>
            <string>public.item</string>
            <string>public.content</string>
         </array>
         <key>UTTypeDescription</key>
         <string>JPEG Image File</string>
         <key>UTTypeTagSpecification</key>
         <dict>
            <key>public.filename-extension</key>
            <array>
            <string>jpg</string>
            </array>
            <key>public.mime-type</key>
            <array>
            <string>image/jpeg</string>
            </array>
         </dict>
      </dict>
   </array>
	<key>LSSupportsOpeningDocumentsInPlace</key>
	<true/>
</dict>
</plist>
1 Like

I get an error that I have a key in my custom plist that is not legal for iOS. Anyone have any idea which that might be?

Right now my app is working wonderfully in the debugger, but if I copy it to my iPhone it crashes when I try to copy a file into my app’s document folder, which is the right thing for me to do when handle URL gives me the open in place = false parameter.

Help!

More hardware vs debugger differences.
in this example “tfile” is a valid folder item in the debugger, but doesn’t exist when copied to my iPhone.

Is this a permission thing?
Do have to add something more to my plist for this to work?

Here is what is working for me (mostly). The image is just the plistadditions.plist file, not the entire info.plist from the built app. Only the database type is showing; the other types are DEM or MBTiles types for my mapping app. I agree that the simulator is working differently than on a real device. For example, on a device, if I try to load a sqlite database using the sharing panel in the Files app, my app crashes. However, if I attach the database to an email and use the sharing panel from inside the Mail program, the database in my app loads just fine! This may be (complete guess here) because I don’t set the UISupportsDocumentBrowser flag explicitly to false it defaults to true so I can also browse my app’s document folder in the files app (which is quite useful).

this is mine.
I am struggling to understand why it’s not working.
I’m still unable to have the document that is passed in the URL to “exist” on the physical device.

If anyone has insight it would be greatly appreciated.

What’s the bundle identifier for your app?

Now that you mention it, it’s likely wrong.
I’m using com.hal4d.spotoncolor, but the identifier you see for the job is because I also have a desktop version of the software where the file was originally created.

Can I make the two bundle identifiers the same (desktop and iOS)?
If so, then should it be would I make it com.hal4d.spotoncolor.spotoncolorjob? or am I totally out to lunch?

mmmm… lockdowns… remember going out to lunch?

Should be

com.hal4d.spotoncolor-spotoncolorjob

Great. I’ve made that change.
It didn’t solve my problem, but now I’m wondering if there is something else at play.

I tried emailing myself the file that I wanted to open, and when I tapped on it from my email it opened fine. When I navigate to my file app, and tap on it there, it does not open (doesn’t exist).
I thought perhaps it was because it was still on the cloud so I downloaded it on my iPhone and it still says unavailable.

ok, so I did a quick test here and I was able to get access png and jpeg files on-device.

Here’s what the plist additions look like:

<key>CFBundleDocumentTypes</key>
   <array>
      <dict>
         <key>CFBundleTypeName</key>
         <string>JPEGimage</string>
         <key>CFBundleTypeExtensions</key>
         <array>
            <string>jpg</string>
         </array>
         <key>LSItemContentTypes</key>
         <array>
            <string>public.jpeg</string>
         </array>
         <key>CFBundleTypeRole</key>
         <string>Viewer</string>
         <key>LSHandlerRank</key>
         <string>Default</string>
      </dict>
      <dict>
         <key>CFBundleTypeName</key>
         <string>PNGimage</string>
         <key>CFBundleTypeExtensions</key>
         <array>
            <string>png</string>
         </array>
         <key>LSItemContentTypes</key>
         <array>
            <string>public.png</string>
         </array>
         <key>CFBundleTypeRole</key>
         <string>Viewer</string>
         <key>LSHandlerRank</key>
         <string>Default</string>
      </dict>
   </array>

   <key>UTImportedTypeDeclarations</key>
   <array>
      <dict>
         <key>UTTypeIdentifier</key>
         <string>public.jpeg</string>
         <key>UTTypeConformsTo</key>
         <array>
            <string>public.image</string>
            <string>public.data</string>
            <string>public.item</string>
            <string>public.content</string>
         </array>
         <key>UTTypeTagSpecification</key>
         <dict>
            <key>public.filename-extension</key>
            <array>
            <string>jpg</string>
            </array>
         </dict>
      </dict>
      <dict>
         <key>UTTypeIdentifier</key>
         <string>public.png</string>
         <key>UTTypeConformsTo</key>
         <array>
            <string>public.image</string>
            <string>public.data</string>
            <string>public.item</string>
            <string>public.content</string>
         </array>
         <key>UTTypeTagSpecification</key>
         <dict>
            <key>public.filename-extension</key>
            <array>
            <string>png</string>
            </array>
         </dict>
      </dict>
   </array>

I do see what you’re seeing though. Types that are owned by the app don’t open.

Got it.

  1. Click on the iOS build target.
  2. In the Inspector, click on the Advanced tab (the little gear)
  3. In the Capabilities section, turn on File Sharing.

Here’s the plist additions for a custom type, in this case, with the extension .mytype:

<key>CFBundleDocumentTypes</key>
   <array>
      <dict>
         <key>CFBundleTypeName</key>
         <string>My Type</string>
         <key>CFBundleTypeExtensions</key>
         <array>
            <string>mytype</string>
         </array>
         <key>LSItemContentTypes</key>
         <array>
            <string>com.stretchedout.myapp-My-Type</string>
         </array>
         <key>CFBundleTypeRole</key>
         <string>Editor</string>
         <key>LSHandlerRank</key>
         <string>Owner</string>
      </dict>
   </array>

   <key>UTExportedTypeDeclarations</key>
   <array>
      <dict>
         <key>UTTypeIdentifier</key>
         <string>com.stretchedout.myapp-My-Type</string>
         <key>UTTypeConformsTo</key>
         <array>
            <string>public.data</string>
         </array>
         <key>UTTypeDescription</key>
         <string>My File Type</string>
         <key>UTTypeTagSpecification</key>
         <dict>
            <key>public.filename-extension</key>
            <array>
            <string>mytype</string>
            </array>
            <key>public.mime-type</key>
            <array>
            <string>text/plain</string>
            </array>
         </dict>
      </dict>
   </array>

Now there is still an issue with things not working if the app isn’t already running. I’ve filed a bug report about that so I can look into it.

Even if my app is running it won’t work.
I must be missing something.

Do you see anything obvious in this plist?

Did you check the File Sharing capability that I described?

yes I did.

I’ll wrap up my sample and make it available so we can see if my app works for you. Not quite at my desk yet, so give me a few minutes.

Here ya go:

https://www.dropbox.com/s/rbuhzyhfj2u7jr5/URLTester2020.zip?dl=1

You’ll need to update the application identifier and in the plistadditions file you’ll need to replace com.stretchedout.myapp with your bundle identifier, but this works on my iPhone 11 running 14.4

1 Like