Open your App's Section in iOS System Settings
When the user declines access to a certain permission, you might want to guide them to the system settings.
For this we have created a global function openAppInSettings
. It opens the settings app and navigates to directly your app's section.
Function definition:
@discardableResult
public func openAppInSettings() -> Bool { }
Note: this function always returns false
.
Because of the way way that requesting capabilities is implemented. When we show a sheet where we ask the user to give us access to a certain capability, there is a closure that gets called when the user presses on 'Accept'. This closure will then return a boolean telling the app whether the user has given us access or not.
But, if the user has already declined access to a certain capability, and we
can only ask them via a system prompt once, next time we replace the system
capability prompt closure with the openAppInSettings()
function. So instead
of showing a system alert saying something like "App would like to Access the
Camera, allow?", pressing on the button will open the settings app, where the
user has to manually enable the permission. But because the function takes in
a closure that returns a boolean, we have to return something, so we simply
return false
to dismiss the capability request.