Arvin Sanmuga Rajah
Arvin Sanmuga Rajah

Reputation: 520

How to open Notification Center via URL Scheme from app?

Using the URL Scheme below, I'm able to open the 'Settings' App from the app I'm currently working on.

[[UIApplication sharedApplication] openURL:[NSURL URLWithString:UIApplicationOpenSettingsURLString]];

Is it also possible to tweak the URL Scheme so that I can directly open the 'Notification Center' feature inside the 'Settings' App?

Kindly advise. All help appreciated!

Upvotes: 4

Views: 1477

Answers (2)

Pablo Blanco
Pablo Blanco

Reputation: 739

I tried this code to prevent crashes from iOS versions and it's working for me:

if ([[UIApplication sharedApplication] respondsToSelector:@selector(openURL:options:completionHandler:)]) {
    [[UIApplication sharedApplication] openURL:[NSURL URLWithString:UIApplicationOpenSettingsURLString] options:@{} completionHandler:nil];
} else {
    [[UIApplication sharedApplication] openURL:[NSURL URLWithString:UIApplicationOpenSettingsURLString]];
}

Upvotes: 2

vhong
vhong

Reputation: 594

tested on iOS 8 up;

you can try this url scheme: "prefs:root=NOTIFICATIONS_ID" But u must add URL types in ur project: Click on ur Project in Project Navigator-> click on TARGET -> tab Info -> and add URL Types by click (+) and add URL scheme : "prefs".

if you still not clear check this Answer here

All the best,

Upvotes: 0

Related Questions