快速设置为默认Web浏览器 [英] swift set as default web browser

查看:203
本文介绍了快速设置为默认Web浏览器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在尝试使用swift制作网络浏览器(对于OS X).我找到了如何制作一个教程,但是我不知道如何将其作为默认的网络浏览器.有办法吗?

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?

推荐答案

使用

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

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

此外,要在系统偏好设置>常规>设置默认Web浏览器下将应用程序显示为默认浏览器设置,请在Xcode项目的信息标签中添加URL类型.确保添加标识符和"http" URL方案.构建并运行:

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:

这篇关于快速设置为默认Web浏览器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆