如何在程序中跳转到设置里的打开蓝牙界面

做蓝牙应用的时候有个需求是:进入app发现没有打开蓝牙,需要切换到系统设置页面的蓝牙中。

网上找了资源是这样写的:

let url = NSURL(string: "prefs:root=Bluetooth");
        if UIApplication.sharedApplication().canOpenURL(url!) {
            UIApplication.sharedApplication().openURL(url!)
        }
原谅我用的是OC,所以我是这样写的:

蓝牙:

NSURL *url = [NSURL URLWithString:@"prefs:root=Bluetooth"];

if ([[UIApplication sharedApplication] canOpenURL:url])

{

   [[UIApplication sharedApplication] openURL:url];

}

定位服务:

NSURL *url = [NSURL URLWithString:@"prefs:root=LOCATION_SERVICES"];

if ([[UIApplication sharedApplicationcanOpenURL:url])

{

   [[UIApplication sharedApplicationopenURL:url];

}

等等,只需要修改url就可以了


浏览资源时发现了下面这个url列表,这个可是好东西,遂记录下来,方便自己,也方便大家

功能URL
关于本机prefs:root=General&path=About
辅助功能prefs:root=General&path=ACCESSIBILITY
飞行模式prefs:root=AIRPLANE_MODE
自动锁定prefs:root=General&path=AUTOLOCK
蓝牙prefs:root=Bluetooth
日期与时间prefs:root=General&path=DATE_AND_TIME
FaceTimeprefs:root=FACETIME
通用prefs:root=General
键盘prefs:root=General&path=Keyboard
iCloudprefs:root=CASTLE
iCloud存储空间prefs:root=CASTLE&path=STORAGE_AND_BACKUP
语言与地区prefs:root=General&path=INTERNATIONAL
定位服务prefs:root=LOCATION_SERVICES
邮件、通讯录、日历prefs:root=ACCOUNT_SETTINGS
音乐prefs:root=MUSIC
音乐prefs:root=MUSIC&path=EQ
音乐prefs:root=MUSIC&path=VolumeLimit
备忘录prefs:root=NOTES
通知prefs:root=NOTIFICATIONS_ID
电话prefs:root=Phone
照片与相机prefs:root=Photos
描述文件prefs:root=General&path=ManagedConfigurationList
还原prefs:root=General&path=Reset
电话铃声prefs:root=Sounds&path=Ringtone
Safariprefs:root=Safari
声音prefs:root=Sounds
软件更新prefs:root=General&path=SOFTWARE_UPDATE_LINK
App Storeprefs:root=STORE
Twitterprefs:root=TWITTER
视频prefs:root=VIDEO
VPNprefs:root=General&path=VPN
墙纸prefs:root=Wallpaper
WiFiprefs:root=WIFI
个人热点prefs:root=INTERNET_TETHERING


About — prefs:root=General&path=About

Accessibility — prefs:root=General&path=ACCESSIBILITY

Airplane Mode On — prefs:root=AIRPLANE_MODE

Auto-Lock — prefs:root=General&path=AUTOLOCK

Brightness — prefs:root=Brightness

Bluetooth — prefs:root=General&path=Bluetooth

Date & Time — prefs:root=General&path=DATE_AND_TIME

FaceTime — prefs:root=FACETIME

General — prefs:root=General

Keyboard — prefs:root=General&path=Keyboard

iCloud — prefs:root=CASTLE

iCloud Storage & Backup — prefs:root=CASTLE&path=STORAGE_AND_BACKUP

International — prefs:root=General&path=INTERNATIONAL

Location Services — prefs:root=LOCATION_SERVICES

Music — prefs:root=MUSIC

Music Equalizer — prefs:root=MUSIC&path=EQ

Music Volume Limit — prefs:root=MUSIC&path=VolumeLimit

Network — prefs:root=General&path=Network

Nike + iPod — prefs:root=NIKE_PLUS_IPOD

Notes — prefs:root=NOTES

Notification — prefs:root=NOTIFICATIONS_ID

Phone — prefs:root=Phone

Photos — prefs:root=Photos

Profile — prefs:root=General&path=ManagedConfigurationList

Reset — prefs:root=General&path=Reset

Safari — prefs:root=Safari

Siri — prefs:root=General&path=Assistant

Sounds — prefs:root=Sounds

Software Update — prefs:root=General&path=SOFTWARE_UPDATE_LINK

Store — prefs:root=STORE

Twitter — prefs:root=TWITTER

Usage — prefs:root=General&path=USAGE

VPN — prefs:root=General&path=Network/VPN

Wallpaper — prefs:root=Wallpaper

Wi-Fi — prefs:root=WIFI




  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值