I am aware of how to generally open the settings from inside an iOS app, but is there a way to send them to settings > privacy > health? It seems this would be a standard thing to do, but I'm not seeing guidance on this in the docs.
Thanks for any suggestions.
As of iOS 9.3 there is no API for opening the Settings app on iOS directly to Settings > Privacy > Health. You should file an enhancement request with Apple.
You can navigate to settings of your app:
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:UIApplicationOpenSettingsURLString]];
As for the health kit, you prompt for the authorization, right? that's where the users should set everything. I don't know if you actually can show the authorization again to change the settings.
Related
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:UIApplicationOpenSettingsURLString]];
I am using this code to open settings app from my app. But is there any URL to open Background App Refresh settings from my app?
No, you are not able to open any specific part in setting from your app. You are just able to redirect to user to those settings which are related to your app permission.
How do I reset the microphone access permission so that the app will ask for microphone access permission again as if it were downloaded fresh from the App Store?
Reinstalling the app does not accomplish what I need. When I set the permissions in Settings->Privacy->Microphone, I can only turn permissions on or off. I need to reset it so that it asks for permissions again.
You can RESET your privacy settings in iOS Settings.
Settings > General > Reset > Reset Location and Privacy.
NOTE: Privacy settings for all apps will be reset.
At least starting from iOs 7.1.1 there are switches to change access permission for every single app.
Look in: Settings->Privacy, select the kind of subsytem of your interest ( eg: microphone ), you will see your app in the list. Change the value of the selector according to your needs.
Have a nice day, Stefano
If you change your bundle identifier, that'll also reset the permissions for your app.
Permissions for an uninstalled app are reset after a day.
So, if it is not urgent, you can wait for it reset. I know this is not an ideal solution but it is app specific
Following on from Stefano's post - if you'd like to direct your user directly to the microphone settings then you can use:
let app = UIApplication.sharedApplication()
app.openURL(NSURL(string:"prefs:root=Privacy&path=MICROPHONE")!)
(at least on iOS 9 - if the Settings app structure changes, then the link will likely need to change)
How to check in my iOS app if my cellullar data are turned off, and show this alert to navigate to it on settings and turn it on.
For example check the image!
Apple has some sample code available named Reachability which you can use to see if the Internet is available.
If WiFi is down, you can bring up your own "You can turn on cellular data for this app" UIAlertView.
Well, iOS 5.1 removed the ability to open Settings, so basically you can't do it in iOS >= 5.1
for iOS < 5.1 was something like that
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:#"prefs:root=General&path=Network"]]
I am trying to get the geolocation of the iOS device. I am able to get the coordinates of the present location using CoreLocation framework.
But the problem is I have to handle the scenario when location services has been disabled from device settings. In that case, I have to redirect the user to settings from within my app as per the requirement.
I know that I can do this using the below scheme prior to iOS 5.1
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:#"prefs://"]];
But, how to handle this in this newer releases. I am stuck with this since a long time and no solution yet. Please advise.
You should call:
[CLLocationManager locationServicesEnabled]
As it states here:
http://developer.apple.com/library/ios/#documentation/CoreLocation/Reference/CLLocationManager_Class/CLLocationManager/CLLocationManager.html
#Rashmi - You might be getting some trouble some where else.
CoreLocation Framework automatically detects if the Location Settings are disabled from the Device via generating an alert and take you automatically to the device settings.I had verified this in iOS7, iOS6 devices.
Moreover, I Googled and found that this is the only way to open setting from the app and that matches with you have written.
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:#"prefs://"]];
You can also follow this URL for reference
Open Device Settings from the app
For Core Location, You can see this demo CoreLocation
I have seen that there are known apps, such as Twitter and Facebook, that display a "Turn Off Airplane Mode or Use Wi-Fi to Access Data" message within an alert view, with a button that switches to the Settings app, when no network is detected as the app goes foreground. This message is the same in all apps where I saw it, is this alert view a kind of predefined one that you can use? Similar to the one displayed when checking locationServicesEnabled...
I found some posts dealing with this issue some time ago, for example:
iOS UIAlertView button to go to Setting App, and it seems (or seemed) to be a way to read the values in the iOS' Settings app, but I couldn't find any of this in the Apple Developer's documentation... is there any public API for accessing those values? Would an app be rejected if accessing them as in the post I linked?
Thanks in advance
Till iOS 5.0, you can use the URL scheme to open the Settings App from third-party apps using the URLScheme like:
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:#"prefs:root=WIFI"]];
Unfortunately, iOS 5.1 and iOS 6 not supports this feature.
You can use the Reachability for checking the Wi-Fi state.
For displaying the default alertview when the Wi-fi is off or in AirPlane mode you can use the Application uses Wi-Fi flag in the info.plist
Refer InfoPlistKeyReference for details:
UIRequiresPersistentWiFi
“Application uses Wi-Fi”
Specifies whether this app requires a Wi-Fi connection.