I have setup RX for photos permission like
extension PHPhotoLibrary {
static var authorize : Observable<Bool> {
return Observable<Bool>.create { (observer) -> Disposable in
if authorizationStatus() == .authorized {
observer.onNext(true)
observer.onCompleted()
} else {
requestAuthorization({ (handler) in
observer.onNext(handler == .authorized)
observer.onCompleted()
})
}
return Disposables.create()
}
}
In App Delegate I am asking for permission
let authorized = PHPhotoLibrary.authorize.share()
authorized.skipWhile{$0 == false}
.take(1)
.subscribe(onNext: {[weak self] (authorized) in
// Nothing here
})
Now When I start App permission dialogue appears which all working fine But when I put app in background and from settings manually toggle permission and when I back to app again app crashes :(
Any help appreciated