Skip to content

Instantly share code, notes, and snippets.

@hotwatermorning
Last active August 25, 2016 08:39
Show Gist options
  • Save hotwatermorning/73fad1cecc76a4209862cd9d2d61ff99 to your computer and use it in GitHub Desktop.
Save hotwatermorning/73fad1cecc76a4209862cd9d2d61ff99 to your computer and use it in GitHub Desktop.
OSXでのURLスキームの実装

OSXでのURLスキームはLaunch Servicesという仕組みによって実装されている。

アプリケーション作成時にInfo.plistに適切にCFBundleURLTypesのデータを設定しておけば、アプリケーションをインストール(アプリケーションを"アプリケーション"ディレクトリにコピー)した時にLaunch Servicesがそれを検知し、Info.plistからURLスキームの設定を読み込んで、専用のデータベース("Launch Services Database")に設定を保持する。

なので、アプリケーションのインストール後はmy-app-scheme://myapp/のようにリンクを作成してそれをオープンするだけで対象のアプリケーションが起動できる。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment