-->

Detect when user opens file in app

2019-07-24 03:30发布

问题:

I was reading this documentation on how to preview a file on my iOS app.

https://developer.apple.com/library/ios/documentation/FileManagement/Conceptual/DocumentInteraction_TopicsForIOS/Articles/PreviewingandOpeningItems.html#//apple_ref/doc/uid/TP40010410-SW1

Is there any to detect which app did the user choose? Or any way to kno if he actually tapped on any option?

My problem: iBooks large file (> 700mb). User chooses preview, then taps on the top right corner and chooses to open on iBooks. It takes between 20 to 45 seconds until it jumps to iBooks. If I know that the user tapped any app I could at least show a loading or whatever so he knows something is about to happen.

回答1:

You can use UIDocumentInteractionControllerDelegate methods to achieve this. Here are the list of methods:

Apple document link