开源软件名称: phynet/iOS-URL-Schemes开源软件地址: https://github.com/phynet/iOS-URL-Schemes开源编程语言:
Swift
100.0%
开源软件介绍: List for iOS URLS SCHEMES
WARNING DEPRECATION
From iOS 11 the schemes url's stoped working correctly. Be aware that from iOS 11 to now iOS 14 this won't work.
Past times are always better
The gist I started on 2015 has now 201 stars (02/25/2017) and a lot of comments. But since gist does not provides a notification feature when someone comments and I can't answer right away, I hope with the issue area in github we can share more doubts and improvements. Thank You all!
Note
Apple will reject apps that are using private url schemes (Ugh, Apple....) if they are pretty much obvius. Some apps are rejected and others are not, so, be aware of this issue before implementing any of those URL's in your app as a feature.
Updates
[UPDATE 5] Apparently we're having problems with iOS 11 and schemes . it seems Apple changed one more time how we reach url schemes...some of them aren't working in mobile phones (but were working in simulator till' Xcode 9 GM)
[UPDATE 4] iOS 10 update: apparently settings now can be reached using App-Pref instead of prefs
[UPDATE 3: For now you just can use url schemes to open your apps's settings with Swift 3.0 (Xcode 8). I'll keep you informed when OS preferences can be reached]
[UPDATE 2:The openURL() method of UIApplication is now deprecated. You should use application(_:open:options:) instead]
[UPDATE : Not yet tested in iOS 10. It will fail because of policies changes in URL scheme handling.]
Testing
Download this Workflow to find and test new App-prefs:
URL Schemes by @deanlyoung
Other Apps' Settings
Sometimes we need to open Setting's Preferences not of our app, but of the iPhone itself. What should we do to acomplish this?
You must configure the URL Schemes in your project. You will find it in Target, Info, URL Scheme. Once there, just type prefs
2.- Later, just write the code with the URL path of the preference needed. In my case was the keyboard path.
Swift 1.2
UIApplication.sharedApplication ().openURL (NSURL (string :" prefs:root=General&path=Keyboard" )! )
Swift 3.0
This is a work around to open your app's preferences, but it will crash if you don't have any.
Open apps's preferences:
Note: you don't need to add prefs
text inside URL Types
if #available (iOS 10.0 , * ) {
UIApplication.shared .open (URL (string :UIApplicationOpenSettingsURLString)! )
}
Open OS preferences:
UIApplication.shared .open (URL (string :" App-prefs:root=General&path=Keyboard" )! )
Swift 4.0
Open apps's preferences:
Note: you don't need to add prefs
text inside URL Types
if #available (iOS 10.0 , * ) {
let settingsUrl = NSURL (string :UIApplicationOpenSettingsURLString)! as URL
UIApplication.shared .open (settingsUrl, options : [: ], completionHandler : nil )
}
Open OS preferences:
if #available (iOS 10.0 , * ) {
let url = NSURL (string :" App-prefs:root=General&path=Keyboard" )! as URL
UIApplication.shared .open (url)
}
Objective-c
[[UIApplication sharedApplication ] openURL: [NSURL URLWithString: @" prefs:root=General&path=Keyboard" ]];
Open App's settings extension
extension UIApplication {
func openAppSettings () {
if let url = URL (string :UIApplicationOpenSettingsURLString) {
openExpectedURL (url)
}
}
fileprivate func openExpectedURL (_ url : URL) {
if UIApplication.shared .canOpenURL (url) {
if #available (iOS 10.0 , * ) {
UIApplication.shared .open (url, options : [: ], completionHandler : nil )
}else {
UIApplication.shared .openURL (url)
}
}
}
}
More info:
URL Schemes
Description
Command Swift < 3 OR Objc
Swift 3
Settings Section topmost level
From Widget (Prefs:
)
From App (App-prefs:
)
About
prefs:root=General&path=About
App-prefs:root=General&path=About
Accessibility
prefs:root=General&path=ACCESSIBILITY
App-prefs:root=General&path=ACCESSIBILITY
Account Settings
prefs:root=ACCOUNT_SETTINGS
App-prefs:root=ACCOUNT_SETTINGS
Airplane Mode
prefs:root=AIRPLANE_MODE
App-prefs:root=AIRPLANE_MODE
Autolock iOS < 10
prefs:root=General&path=AUTOLOCK
App-prefs:root=General&path=AUTOLOCK
Auto-Lock iOS > 10
prefs:root=DISPLAY&path=AUTOLOCK
App-prefs:root=DISPLAY&path=AUTOLOCK
Apple Pay / Wallet
shoebox://url-scheme
shoebox://url-scheme
Battery
prefs:root=BATTERY_USAGE
App-prefs:root=BATTERY_USAGE
Brightness
prefs:root=Brightness
App-prefs:root=Brightness
Bluetooth iOS < 9
prefs:root=General&path=Bluetooth
App-prefs:root=General&path=Bluetooth
Bluetooth iOS > 9
prefs:root=Bluetooth
App-prefs:root=Bluetooth
Castle
prefs:root=CASTLE
App-prefs:root=CASTLE
Cellular Usage
prefs:root=General&path=USAGE/CELLULAR_USAGE
App-prefs:root=General&path=USAGE/CELLULAR_USAGE
Configuration List
prefs:root=General&path=ManagedConfigurationList
App-prefs:root=General&path=ManagedConfigurationList
Date and Time
prefs:root=General&path=DATE_AND_TIME
App-prefs:root=General&path=DATE_AND_TIME
Do not disturb
prefs:root=General&path=DO_NOT_DISTURB
App-prefs:root=General&path=DO_NOT_DISTURB
Facetime
prefs:root=FACETIME
App-prefs:root=FACETIME
General
prefs:root=General
App-prefs:root=General
Internet Tethering
prefs:root=INTERNET_TETHERING
App-prefs:root=INTERNET_TETHERING
iTunes
prefs:root=MUSIC
App-prefs:root=MUSIC
iTunes Equalizer
prefs:root=MUSIC&path=EQ
App-prefs:root=MUSIC&path=EQ
iTunes Volume
prefs:root=MUSIC&path=VolumeLimit
App-prefs:root=MUSIC&path=VolumeLimit
Keyboard
prefs:root=General&path=Keyboard
App-prefs:root=General&path=Keyboard
Deeper in Keyboard
prefs:root=General&path=Keyboard/KEYBOARDS
App-prefs:root=General&path=Keyboard/KEYBOARDS
Lang International
prefs:root=General&path=INTERNATIONAL
App-prefs:root=General&path=INTERNATIONAL
Location Services
prefs:root=Privacy&path=LOCATION
App-Prefs:root=Privacy&path=LOCATION
Mobile Data
prefs:root=MOBILE_DATA_SETTINGS_ID
Network
prefs:root=General&path=Network
App-prefs:root=General&path=Network
Nike iPod
prefs:root=NIKE_PLUS_IPOD
App-prefs:root=NIKE_PLUS_IPOD
Notes
prefs:root=NOTES
App-prefs:root=NOTES
Notifications ID
prefs:root=NOTIFICATIONS_ID
App-prefs:root=NOTIFICATIONS_ID
Passcode / Touch ID
prefs:root=TOUCHID_PASSCODE
App-prefs:root=TOUCHID_PASSCODE
Passbook
prefs:root=PASSBOOK
App-prefs:root=PASSBOOK
Phone
prefs:root=Phone
App-prefs:root=Phone
Photo Camera Roll
prefs:root=Photos
App-prefs:root=Photos
Privacy
Prefs:root=Privacy
App-prefs:root=Privacy
Profiles & Device Management
Prefs:root=General&path=ManagedConfigurationList
App-prefs:root=General&path=ManagedConfigurationList
Reset
prefs:root=General&path=Reset
App-prefs:root=General&path=Reset
Ringtone
prefs:root=Sounds&path=Ringtone
App-prefs:root=Sounds&path=Ringtone
Siri
prefs:root=SIRI
App-prefs:root=SIRI
Safari
prefs:root=Safari
App-prefs:root=Safari
Siri iOS < 10?
prefs:root=General&path=Assistant
App-prefs:root=General&path=Assistant
Siri iOS > 10?
prefs:root=SIRI
App-prefs:root=SIRI
Sounds
prefs:root=Sounds
App-prefs:root=Sounds
Software Update
prefs:root=General&path=SOFTWARE_UPDATE_LINK
App-prefs:root=General&path=SOFTWARE_UPDATE_LINK
Storage & Backup
prefs:root=CASTLE&path=STORAGE_AND_BACKUP
App-prefs:root=CASTLE&path=STORAGE_AND_BACKUP
Store
prefs:root=STORE
App-pref:root=STORE
Twitter
prefs:root=TWITTER
App-prefs:root=TWITTER
Usage
prefs:root=General&path=USAGE
App-prefs:root=General&path=USAGE
Video
prefs:root=VIDEO
App-prefs:root=VIDEO
VPN
prefs:root=General&path=Network/VPN
App-prefs:root=General&path=Network/VPN
Wallpaper
prefs:root=Wallpaper
App-prefs:root=Wallpaper
WIFI
prefs:root=WIFI
App-prefs:root=WIFI
Open other App's Notification settings
You can open any app notification's settings, only if that app HAS notifications enabled. For that you need the bundleID added in path:
UIApplication.shared .openURL (NSURL (string :" App-prefs:root=NOTIFICATIONS_ID&path=com.microsoft.Office.Word" )! as URL)
Finding an app's bundle identifier of any app:
Find the app you are looking for on the Apple AppStore. For this example, we’ll use Yelp: https://itunes.apple.com/us/app/yelp/id284910350?mt=8
Copy the app ID number. It’s just the numbers after the text “id” and before the “?”. So in this case, it is: 284910350.
Paste that ID number into this URL: https://itunes.apple.com/lookup?id=284910350
This will download a file 1.txt
Search the output you get back for “bundleId ”. The app’s bundle ID will be listed there: com.yelp.yelpiphone
source: https://kb.acronis.com/content/39368
Bluetooth
As @johnny77221 mention in comments, he impleted a way to open bluetooth settings, read in link above:
https://gist.github.com/johnny77221/bcaa5384a242b64bfd0b8a715f48e69f
Apple Pay / Wallet
by @luismadrigal
Cordova Plugin
@guyromb made a cordova plugin
https://github.com/guyromb/Cordova-open-native-settings/blob/master/src/ios/NativeSettings.m
A cocopods plugin
it seems @yoiang made a plugin for cocoapods. Although it appears that is not updated to iOS > 10 but you can contribute to his project if you like it ;)
https://github.com/Adorkable/SettingsAppAccessiOS
Open App Store
UIApplication.shared .openURL (URL (string : " itms-apps://itunes.apple.com/app/id" + appStoreAppID)! )
Contributions:
@antonjn , @mikengyn , @johnny77221 , @luismadrigal , @guyromb , @yoiang , @deanlyoung , @axlmagnum
请发表评论