Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iPhone file extension app association

On my iPhone, I'm running an app called Caissa Chess. After registering the app with the manufacturer (this is optional) I received an email, containing a chess puzzle. The crucial part of the mail message, showing a chess diagram looks like this:

<a href="chess://puzzle/8/p1R3p1/4p1kn/3p3N/3Pr2P/6P1/PP3K2/8 w ?term=w2&solution=c7xg7&description=Amura%20vs%20Carlos%20Bulcourf%2C%20Villa%20Ballester%2C%201996"><img src="cid:image1"></a>

Tapping the diagram displayed by this URL quits Mail.app and opens Caissa Chess, that then displays the diagram, and allows you to solve the puzzle.

How does this work?I want to make a little app for the iPhone, that will need an external file, sent by email. I will fist need to understand what's going on.

  • chess:// how and where is defined what application will be opened?
  • what does the rest of the URL mean? Would it be referring to a local file, or will it be resolved by the app as a live http: url? The email message body contains an image attachment.

I'm sure that this mechanism is documented somewhere, but the books I have don't describe it, and Google didn't help me either.

Thank you in advance

Sjakelien

like image 433
Sjakelien Avatar asked Aug 17 '09 07:08

Sjakelien


2 Answers

You have to register the protocol in your app. I've seen a few tutorials before, including this one.

http://iosdevelopertips.com/cocoa/launching-your-own-application-via-a-custom-url-scheme.html

like image 88
arooaroo Avatar answered Oct 21 '22 23:10

arooaroo


It's called a URL protocol handler. This blog entry details how to implement it. Basically, you need to:

  1. Register the protocol you want (like chess://). You can do this directly in the Info.plist file - check out the blog entry for more info.

  2. Handle the request. For this, accept the application: handleOpenURL: message in your application delegate.

like image 25
Jesse Beder Avatar answered Oct 22 '22 01:10

Jesse Beder