我已经在windows中完成了,我如何在mac osx上注册一个协议。我想单击 Firefox 中的链接(a href="somename://mylinkAndData")并启动二进制文件?
7305 次
1 回答
14
查看 Apple 的Launch Services Programming Guide。您必须将CFBundleURLTypes添加到您的应用程序 Info.plist 并使用LSRegisterURL()注册您的应用程序。
摘自Firefox.app/Contents/Info.plist:
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleURLIconFile</key>
<string>document.icns</string>
<key>CFBundleURLName</key>
<string>http URL</string>
<key>CFBundleURLSchemes</key>
<array>
<string>http</string>
</array>
</dict>
....
编辑:请参阅在 Cocoa中处理 URL 方案以获取操作指南文章
于 2009-02-27T17:46:37.563 回答