Skip to content
This repository has been archived by the owner on Feb 27, 2019. It is now read-only.

Changing formerly Denied Permission triggers 'Presenting view controllers on detached view controllers is discouraged <PermissionScope.PermissionScope: 0x7fe1120a1000>' #226

Closed
ghost opened this issue Apr 5, 2017 · 1 comment

Comments

@ghost
Copy link

ghost commented Apr 5, 2017

I'm not quite sure how to debug this issue.

I built a singly referenced PermissionScope like so:

    static let cameraHardwareScope: PermissionScope = {
                
        let scope = PermissionScope()
        
        scope.addPermission(CameraPermission(),
                                  message: "For snapping photos of programs, receipts & selfies.")
        scope.addPermission(PhotosPermission(),
                                  message: "Or maybe you've already taken the photograph.")
        
        return scope
        
    }()

And present it like so:

        PermissionScope.cameraHardwareScope.show(
            { finished, results in
                
                guard finished else {
                    return
                }
                
                self.present(viewController, animated: flag, completion: completion)
            },
            cancelled: { results in
                
            }
        )

If a permission was formerly denied and I tap 'Show Me' to grant that permission access, upon granting (while my app is still in the background) the logger reads:

Presenting view controllers on detached view controllers is discouraged <PermissionScope.PermissionScope: 0x7fe1120a1000>.

And i'm thrown a SIGKILL on the main thread.

I noticed the PersmissionScope (View Controller) is being presented from the UIApplication's keyWindow and thus I have no control over the UIViewController doing the presentation.

How can I modify my code so that PermissionScope doesn't crash my App in the background?

@nickoneill
Copy link
Owner

As designed from Apple: #160

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant