美文网首页iOS Developer
【iOS开发】APP内跳转到设置页面

【iOS开发】APP内跳转到设置页面

作者: volientDuan | 来源:发表于2017-04-26 13:55 被阅读189次

跳转到设置页面的相关blog或者问题有很多,这里只是总结并且封装成工具类方便下次使用

必须提一下:如果没有特殊需要建议直接使用UIApplicationOpenSettingsURLString

NSURL *url = [NSURL URLWithString:UIApplicationOpenSettingsURLString];

    if ([[UIApplication sharedApplication] canOpenURL:url]) {
        
        [[UIApplication sharedApplication] openURL:url]; 
    }

<= iOS 9 的跳转方法(注意prefs) 后面附有相关不同设置页的路径

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

    if ([[UIApplication sharedApplication] canOpenURL:url]) {
        
        [[UIApplication sharedApplication] openURL:url]; 
    }

iOS 10 更新以后,发现以前跳转系统应用的方法无效了,是不能跳到相关的设置页了吗?答案是否定的,接下来提供一个可以通过审核的正确的跳转方法

// 就一句话:把上面方法中的`prefs`替换为`APP-Prefs`😄
NSURL *url = [NSURL URLWithString:@"APP-Prefs:root=General&path=Bluetooth"];

    if ([[UIApplication sharedApplication] canOpenURL:url]) {
        
        [[UIApplication sharedApplication] openURL:url]; 
    }

附上适配好的跳转工具类VDSSetPageTool

设置页路径附录

Wi-Fi — prefs:root=WIFI

General— prefs:root=General

About — prefs:root=General&path=About  

Accessibility — prefs:root=General&path=ACCESSIBILITY  

AirplaneModeOn— 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

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 VolumeLimit— 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  

SoftwareUpdate— 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  

Setting—prefs:root=INTERNET_TETHERING

相关文章

网友评论

    本文标题:【iOS开发】APP内跳转到设置页面

    本文链接:https://www.haomeiwen.com/subject/rquizttx.html