Closed SirSamShaw closed 7 years ago
@SirSamShaw Hi! You can send me example project? My English is bad and I don't understand that troubles with project
@SirSamShaw didHide means they did not tap to take action on a permission request. But this is how I handle things so that they are not shown the permission request if they've already given permission.
class ViewController: UIViewController, SPRequestPermissionEventsDelegate {
@IBAction func btn1(_ sender: Any) {
if SPRequestPermission.isAllowPermission(.locationWhenInUse) {
self.desiredAction()
} else {
SPRequestPermission.dialog.interactive.present(on: self, with: [.locationWhenInUse])
}
}
func didAllowPermission(permission: SPRequestPermissionType) {
if permission == .locationWhenInUse {
self.desiredAction()
}
}
func desiredAction() {
//whatever you want to happen now
}
func didDeniedPermission(permission: SPRequestPermissionType) {
//required?
}
func didSelectedPermission(permission: SPRequestPermissionType) {
//required?
}
func didHide() {
//required?
}
}
Hi @mgt-la
In my code, dont entry to the protocol SPRequestPermissionEventsDelegate
class ConfigurationViewController: FormViewController, SPRequestPermissionEventsDelegate {
// ....
func didHide() {
print("didHide")
}
func didAllowPermission(permission: SPRequestPermissionType) {
print("didAllowPermission")
}
func didDeniedPermission(permission: SPRequestPermissionType) {
print("didDeniedPermission")
}
func didSelectedPermission(permission: SPRequestPermissionType) {
print("didSelectedPermission")
}
}
Any ideas ?
@jonajgs you set delegate? show code
@IvanVorobei
the code is above, i only miss the viewDidLoad
class ConfigurationViewController: FormViewController, SPRequestPermissionEventsDelegate {
override func viewDidLoad() {
super.viewDidLoad()
GIDSignIn.sharedInstance().delegate = self
GIDSignIn.sharedInstance().uiDelegate = self
buildForm()
}
func buildForm() {
}
func didHide() {
print("didHide")
}
func didAllowPermission(permission: SPRequestPermissionType) {
print("didAllowPermission")
}
func didDeniedPermission(permission: SPRequestPermissionType) {
print("didDeniedPermission")
}
func didSelectedPermission(permission: SPRequestPermissionType) {
print("didSelectedPermission")
}
}
what delegate do I forget ?
@IvanVorobei
I have another question, I have a UISwitch in my uiview, when the switch is disabled and I change the switch to active, i dont know how restart the app, because, i have in my appDelegate a geofence monitoring, but at the start the app dont have the permissions, I searching the way to refresh the app or any other idea, do you have help me please ?
I am using the isAllowed as documented and when checking if all permissions are granted, it will not print it out let alone segue.. can I have a code sample of checking for a permission and segueing on didHide()