Skip to content

Commit 8601678

Browse files
committed
permission callback fix in mainthread
1 parent ed79edb commit 8601678

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

Source/LBXPermissions.swift

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,11 @@ class LBXPermissions: NSObject {
2626
comletion(false)
2727
case PHAuthorizationStatus.notDetermined:
2828
PHPhotoLibrary.requestAuthorization({ (status) in
29-
comletion(status == PHAuthorizationStatus.authorized ? true:false)
29+
30+
DispatchQueue.main.async {
31+
comletion(status == PHAuthorizationStatus.authorized ? true:false)
32+
33+
}
3034
})
3135
}
3236

@@ -50,7 +54,10 @@ class LBXPermissions: NSObject {
5054
case AVAuthorizationStatus.notDetermined:
5155

5256
AVCaptureDevice.requestAccess(for: AVMediaType.video, completionHandler: { (granted:Bool) in
53-
comletion(granted)
57+
58+
DispatchQueue.main.async {
59+
comletion(granted)
60+
}
5461
})
5562
}
5663
}

0 commit comments

Comments
 (0)