Open Wifi Settings programatically from pop-up notification
up vote
1
down vote
favorite
I'm using the code snippet below, but it does not seem to open the Settings, it opens the Notifications settings of the app.
I need to open the wifi settings to enable the user to switch it off, iOS 12, Swift 4.2
{
if response.actionIdentifier == "action1" {
guard let settingsUrl = URL(string: UIApplication.openSettingsURLString) else {
return
}
if UIApplication.shared.canOpenURL(settingsUrl) {
UIApplication.shared.open(settingsUrl, completionHandler: { (success) in
print("Settings opened: (success)") // Prints true
})
}
}
}
ios swift unusernotificationcenter
add a comment |
up vote
1
down vote
favorite
I'm using the code snippet below, but it does not seem to open the Settings, it opens the Notifications settings of the app.
I need to open the wifi settings to enable the user to switch it off, iOS 12, Swift 4.2
{
if response.actionIdentifier == "action1" {
guard let settingsUrl = URL(string: UIApplication.openSettingsURLString) else {
return
}
if UIApplication.shared.canOpenURL(settingsUrl) {
UIApplication.shared.open(settingsUrl, completionHandler: { (success) in
print("Settings opened: (success)") // Prints true
})
}
}
}
ios swift unusernotificationcenter
Have you tried this ? stackoverflow.com/a/34024467/5464805
– Olympiloutre
Nov 13 at 9:59
You can not openWifi-Settings
directly. Apple only allows to open settings. There are many answers to openWifi-settings
only but then your app will get rejection if the reviewer noticed this behavior.
– Kamran
Nov 13 at 10:00
Possible duplicate of How to open WIFI setting in Swift 3
– Kamran
Nov 13 at 10:01
I'm getting this when compiling the code with the suggested link [stackoverflow.com/questions/39764553/…:UIApplicationOpenSettingsURLString' has been renamed to 'UIApplication.openSettingsURLString
This opens "Allow AppName to access:" and not the General Settings Page
– shawn.t
Nov 13 at 12:51
The method in the link opens the App's settings, not the phone's settings. How do I open the phone's settings?
– shawn.t
Nov 13 at 13:08
add a comment |
up vote
1
down vote
favorite
up vote
1
down vote
favorite
I'm using the code snippet below, but it does not seem to open the Settings, it opens the Notifications settings of the app.
I need to open the wifi settings to enable the user to switch it off, iOS 12, Swift 4.2
{
if response.actionIdentifier == "action1" {
guard let settingsUrl = URL(string: UIApplication.openSettingsURLString) else {
return
}
if UIApplication.shared.canOpenURL(settingsUrl) {
UIApplication.shared.open(settingsUrl, completionHandler: { (success) in
print("Settings opened: (success)") // Prints true
})
}
}
}
ios swift unusernotificationcenter
I'm using the code snippet below, but it does not seem to open the Settings, it opens the Notifications settings of the app.
I need to open the wifi settings to enable the user to switch it off, iOS 12, Swift 4.2
{
if response.actionIdentifier == "action1" {
guard let settingsUrl = URL(string: UIApplication.openSettingsURLString) else {
return
}
if UIApplication.shared.canOpenURL(settingsUrl) {
UIApplication.shared.open(settingsUrl, completionHandler: { (success) in
print("Settings opened: (success)") // Prints true
})
}
}
}
ios swift unusernotificationcenter
ios swift unusernotificationcenter
edited Nov 13 at 10:07
asked Nov 13 at 9:42
shawn.t
255
255
Have you tried this ? stackoverflow.com/a/34024467/5464805
– Olympiloutre
Nov 13 at 9:59
You can not openWifi-Settings
directly. Apple only allows to open settings. There are many answers to openWifi-settings
only but then your app will get rejection if the reviewer noticed this behavior.
– Kamran
Nov 13 at 10:00
Possible duplicate of How to open WIFI setting in Swift 3
– Kamran
Nov 13 at 10:01
I'm getting this when compiling the code with the suggested link [stackoverflow.com/questions/39764553/…:UIApplicationOpenSettingsURLString' has been renamed to 'UIApplication.openSettingsURLString
This opens "Allow AppName to access:" and not the General Settings Page
– shawn.t
Nov 13 at 12:51
The method in the link opens the App's settings, not the phone's settings. How do I open the phone's settings?
– shawn.t
Nov 13 at 13:08
add a comment |
Have you tried this ? stackoverflow.com/a/34024467/5464805
– Olympiloutre
Nov 13 at 9:59
You can not openWifi-Settings
directly. Apple only allows to open settings. There are many answers to openWifi-settings
only but then your app will get rejection if the reviewer noticed this behavior.
– Kamran
Nov 13 at 10:00
Possible duplicate of How to open WIFI setting in Swift 3
– Kamran
Nov 13 at 10:01
I'm getting this when compiling the code with the suggested link [stackoverflow.com/questions/39764553/…:UIApplicationOpenSettingsURLString' has been renamed to 'UIApplication.openSettingsURLString
This opens "Allow AppName to access:" and not the General Settings Page
– shawn.t
Nov 13 at 12:51
The method in the link opens the App's settings, not the phone's settings. How do I open the phone's settings?
– shawn.t
Nov 13 at 13:08
Have you tried this ? stackoverflow.com/a/34024467/5464805
– Olympiloutre
Nov 13 at 9:59
Have you tried this ? stackoverflow.com/a/34024467/5464805
– Olympiloutre
Nov 13 at 9:59
You can not open
Wifi-Settings
directly. Apple only allows to open settings. There are many answers to open Wifi-settings
only but then your app will get rejection if the reviewer noticed this behavior.– Kamran
Nov 13 at 10:00
You can not open
Wifi-Settings
directly. Apple only allows to open settings. There are many answers to open Wifi-settings
only but then your app will get rejection if the reviewer noticed this behavior.– Kamran
Nov 13 at 10:00
Possible duplicate of How to open WIFI setting in Swift 3
– Kamran
Nov 13 at 10:01
Possible duplicate of How to open WIFI setting in Swift 3
– Kamran
Nov 13 at 10:01
I'm getting this when compiling the code with the suggested link [stackoverflow.com/questions/39764553/…:
UIApplicationOpenSettingsURLString' has been renamed to 'UIApplication.openSettingsURLString
This opens "Allow AppName to access:" and not the General Settings Page– shawn.t
Nov 13 at 12:51
I'm getting this when compiling the code with the suggested link [stackoverflow.com/questions/39764553/…:
UIApplicationOpenSettingsURLString' has been renamed to 'UIApplication.openSettingsURLString
This opens "Allow AppName to access:" and not the General Settings Page– shawn.t
Nov 13 at 12:51
The method in the link opens the App's settings, not the phone's settings. How do I open the phone's settings?
– shawn.t
Nov 13 at 13:08
The method in the link opens the App's settings, not the phone's settings. How do I open the phone's settings?
– shawn.t
Nov 13 at 13:08
add a comment |
1 Answer
1
active
oldest
votes
up vote
0
down vote
Open settings, don't open wifi setting. My app was rejected once when i opened wifi setting directly from my app. Avoid using private apis, apple may reject your app.
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
0
down vote
Open settings, don't open wifi setting. My app was rejected once when i opened wifi setting directly from my app. Avoid using private apis, apple may reject your app.
add a comment |
up vote
0
down vote
Open settings, don't open wifi setting. My app was rejected once when i opened wifi setting directly from my app. Avoid using private apis, apple may reject your app.
add a comment |
up vote
0
down vote
up vote
0
down vote
Open settings, don't open wifi setting. My app was rejected once when i opened wifi setting directly from my app. Avoid using private apis, apple may reject your app.
Open settings, don't open wifi setting. My app was rejected once when i opened wifi setting directly from my app. Avoid using private apis, apple may reject your app.
answered Nov 13 at 10:08
Viren Malhan
424
424
add a comment |
add a comment |
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53278042%2fopen-wifi-settings-programatically-from-pop-up-notification%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Have you tried this ? stackoverflow.com/a/34024467/5464805
– Olympiloutre
Nov 13 at 9:59
You can not open
Wifi-Settings
directly. Apple only allows to open settings. There are many answers to openWifi-settings
only but then your app will get rejection if the reviewer noticed this behavior.– Kamran
Nov 13 at 10:00
Possible duplicate of How to open WIFI setting in Swift 3
– Kamran
Nov 13 at 10:01
I'm getting this when compiling the code with the suggested link [stackoverflow.com/questions/39764553/…:
UIApplicationOpenSettingsURLString' has been renamed to 'UIApplication.openSettingsURLString
This opens "Allow AppName to access:" and not the General Settings Page– shawn.t
Nov 13 at 12:51
The method in the link opens the App's settings, not the phone's settings. How do I open the phone's settings?
– shawn.t
Nov 13 at 13:08