swift set as default web browser

丶灬走出姿态 提交于 2020-01-15 10:08:10

问题


I am currently trying to make a web browser (for OS X) using swift. I have found tutorials on how to make one however I do not know how to make it as my default web browser. Is there a way I can do this?


回答1:


Use the Launch Services API to manually set the default handler for the http URL scheme:

LSSetDefaultHandlerForURLScheme("http", "com.ORGANIZATION.APPNAME")

Additionally, to expose the app as a default browser setting under System Preferences > General > Set default web browser, add a URL type in the info tab of the Xcode project. Make sure to add an Identifier and the "http" URL Scheme. Build and run:



来源:https://stackoverflow.com/questions/27314938/swift-set-as-default-web-browser

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!