UIDocumentInteractionController with non-standard file types


Steve Mills
 

My iOS app has 2 custom UTIs declared in the Imported UTIs section, and 3 Document Types (those 2, plus pdf). When I try to share a file (doesn't matter if the URL's UTI is one of the custom types or pdf), it presentOpenInMenuFromBarButtonItem:animated: fails. If I use presentOptionsMenuFromBarButtonItem:buttonItem:animated:, it works.

This is all in the simulator, so there might not be any apps that Open In will work with. The files are in my app's Documents dir. I have the delegate set to my view controller, and I implemented ALL UIDocumentInteractionControllerDelegate the methods so I could log which ones get called. None get called when I use the OpenIn version. Here are the messages in the simulator's log when I use the OptionsMenu version. Could it be an entitlements problem?

Jul 11 16:49:52 MN5669AM007052 Box of Fun[69053]: UIDocumentInteractionControllerDelegate implements legacy action methods. Please remove them.
Jul 11 16:49:52 MN5669AM007052 Box of Fun[69053]: can perform print:
Jul 11 16:49:52 MN5669AM007052 Box of Fun[69053]: can perform copy:
Jul 11 16:49:52 MN5669AM007052 Box of Fun[69053]: can perform saveToCameraRoll:
Jul 11 16:49:53 MN5669AM007052 Box of Fun[69053]: will present options
Jul 11 16:49:55 MN5669AM007052 pkd[33271]: SecTaskLoadEntitlements failed error=22 cs_flags=200, task->pid_self=-1
Jul 11 16:49:55 MN5669AM007052 pkd[33271]: SecTaskCopyDebugDescription: Box of Fun[69053]
Jul 11 16:49:55 MN5669AM007052 Box of Fun[69053]: SecTaskLoadEntitlements failed error=22 cs_flags=200, task->pid_self=69053
Jul 11 16:49:55 MN5669AM007052 Box of Fun[69053]: SecTaskCopyDebugDescription: Box of Fun[69053]
Jul 11 16:49:59 MN5669AM007052 Box of Fun[69053]: presented open in
Jul 11 16:50:06 MN5669AM007052 assertiond[33257]: assertion failed: 14F2411 13C75: assertiond + 13207 [792516D1-991E-36EE-8454-16F8220758D6]: 0x1

Sent from iCloud's ridiculous UI, so, sorry about the formatting


Steve Christensen <punster@...>
 

On Jul 11, 2017, at 2:53 PM, Steve Mills <sjmills@...> wrote:

My iOS app has 2 custom UTIs declared in the Imported UTIs section, and 3 Document Types (those 2, plus pdf). When I try to share a file (doesn't matter if the URL's UTI is one of the custom types or pdf), it presentOpenInMenuFromBarButtonItem:animated: fails. If I use presentOptionsMenuFromBarButtonItem:buttonItem:animated:, it works.

This is all in the simulator, so there might not be any apps that Open In will work with. The files are in my app's Documents dir. I have the delegate set to my view controller, and I implemented ALL UIDocumentInteractionControllerDelegate the methods so I could log which ones get called. None get called when I use the OpenIn version. Here are the messages in the simulator's log when I use the OptionsMenu version. Could it be an entitlements problem?

Jul 11 16:49:52 MN5669AM007052 Box of Fun[69053]: UIDocumentInteractionControllerDelegate implements legacy action methods. Please remove them.
Jul 11 16:49:52 MN5669AM007052 Box of Fun[69053]: can perform print:
Jul 11 16:49:52 MN5669AM007052 Box of Fun[69053]: can perform copy:
Jul 11 16:49:52 MN5669AM007052 Box of Fun[69053]: can perform saveToCameraRoll:
Jul 11 16:49:53 MN5669AM007052 Box of Fun[69053]: will present options
Jul 11 16:49:55 MN5669AM007052 pkd[33271]: SecTaskLoadEntitlements failed error=22 cs_flags=200, task->pid_self=-1
Jul 11 16:49:55 MN5669AM007052 pkd[33271]: SecTaskCopyDebugDescription: Box of Fun[69053]
Jul 11 16:49:55 MN5669AM007052 Box of Fun[69053]: SecTaskLoadEntitlements failed error=22 cs_flags=200, task->pid_self=69053
Jul 11 16:49:55 MN5669AM007052 Box of Fun[69053]: SecTaskCopyDebugDescription: Box of Fun[69053]
Jul 11 16:49:59 MN5669AM007052 Box of Fun[69053]: presented open in
Jul 11 16:50:06 MN5669AM007052 assertiond[33257]: assertion failed: 14F2411 13C75: assertiond + 13207 [792516D1-991E-36EE-8454-16F8220758D6]: 0x1

Sent from iCloud's ridiculous UI, so, sorry about the formatting


Steve Mills
 

On Jul 12, 2017, at 08:44:19, Steve Christensen <punster@...> wrote:

Have you tried it on a real device to see if there is any difference in behavior?
That was the problem. Too bad it doesn't at least spit out a log message that no apps could be found. That would've saved lots of confusion and debugging.

--
Steve Mills
Drummer, Mac geek


Steve Christensen <punster@...>
 

On Jul 12, 2017, at 10:56 AM, Steve Mills <sjmills@...> wrote:

On Jul 12, 2017, at 08:44:19, Steve Christensen <punster@...> wrote:

Have you tried it on a real device to see if there is any difference in behavior?
That was the problem. Too bad it doesn't at least spit out a log message that no apps could be found. That would've saved lots of confusion and debugging.
It is spitting out what it finds, not what it doesn't. And depending on what you were expecting, it could have reported the same behavior on a real device, depending on what apps are installed. Which is how it should be.

Sure, it can be inconvenient for debugging when you're not seeing expected results but that method isn't purposefully misleading.


Steve Mills
 

On Jul 12, 2017, at 13:16:37, Steve Christensen <punster@...> wrote:

It is spitting out what it finds, not what it doesn't. And depending on what you were expecting, it could have reported the same behavior on a real device, depending on what apps are installed. Which is how it should be.

Sure, it can be inconvenient for debugging when you're not seeing expected results but that method isn't purposefully misleading.
Your opinion. Plenty of Apple software spit out log messages that are *far* less informative than a simple "No apps found - not displaying Open In" would be.

--
Steve Mills
Drummer, Mac geek