Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.


  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • DownloadDownload
  • PrintPrint
Share this Page URL
Help

16. Documents and Data Sharing > Recipe: Checking for the Open Menu

Recipe: Checking for the Open Menu

When using a document interaction controller, be aware of this rule of thumb: The options menu will almost always provide some kind of menu choices, especially if you implement the action and quick look callbacks. You may not, however, have any open-in options to work with.

That happens when there are no applications installed on a device that support the file type you are working with. This may be caused by an obscure file type, or more often, because the user has not yet purchased and installed any applications that offer that file type.

Because of this, you’ll want to check whether to offer an “Open” menu option in the first place. Recipe 16-4 performs a rather ugly test to see if external apps will offer themselves as presenters and editors for a given URL. What it does is this: It creates a new, temporary controller, and attempts to present it. If it succeeds, there are conforming file destinations installed on the device and the method immediately dismisses the controller. If not, there are no such apps, and any “Open In” buttons should be disabled.


  

You are currently reading a PREVIEW of this book.

                                                                                        

Get instant access to over
$1 million worth of books and videos.

  

Start a Free Trial