Changing formerly Denied Permission triggers 'Presenting view controllers on detached view controllers is discouraged <PermissionScope.PermissionScope: 0x7fe1120a1000>'
opened this issue · comments
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?
As designed from Apple: #160