Reputation: 842
How to Open Keyboard's settings screen programmatically in iOS 10?
This code is not working in iOS 10
NSURL *keyboardSettingsURL = [NSURL URLWithString: @"prefs:root=General&path=Keyboard/KEYBOARDS"];
[[UIApplication sharedApplication] openURL:keyboardSettingsURL];
and added URL Scheme
Upvotes: 6
Views: 2763
Reputation: 1312
For IOS-10 or higher,openURL is deprecated. use with completion handler like below.
NSString *settingsUrl= @"App-Prefs:root=General&path=Keyboard";
if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 10.0){
if ([[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:settingsUrl]]) {
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:settingsUrl] options:@{} completionHandler:nil];
}
}
Upvotes: 0
Reputation: 21
is work in iOS 10+
NSURL *keboardURL = [NSURL URLWithString: @"App-Prefs:root=General&path=Keyboard/KEYBOARDS"];
[[UIApplication sharedApplication] openURL:keyboardURL];
key points:
@"App-Prefs:root=General&path=Keyboard/KEYBOARDS"
Upvotes: 2
Reputation: 1370
In iOS 10, a new url is required. Try using this code which tests both urls :
NSArray* urlStrings = @[@"prefs:root=General&path=Keyboard/KEYBOARDS", @"App-Prefs:root=General&path=Keyboard/KEYBOARDS"];
for(NSString* urlString in urlStrings){
NSURL* url = [NSURL URLWithString:urlString];
if([[UIApplication sharedApplication] canOpenURL:url]){
[[UIApplication sharedApplication] openURL:url];
break;
}
}
Upvotes: 0
Reputation: 23634
It looks like this functionality has been disabled in iOS 10. I believe that https://developer.apple.com/library/content/qa/qa1924/_index.html is no longer valid. I checked several top keyboard apps and they have either been updated to no longer have a direct link to the preferences, or have a non-working button.
Upvotes: 5
Reputation: 68
You may need to add a URL Scheme to your project if you haven't already. Instructions and more details can be found at this Apple Q&A Reference. Hope this helps!
Upvotes: 0