request Photo authorization earlier to avoid crash

This commit is contained in:
Danmei Chen 2020-06-22 11:05:02 +02:00
parent f2b1e7bc29
commit bb85becf49

View file

@ -281,6 +281,16 @@
}
}
if ([PHPhotoLibrary authorizationStatus] != PHAuthorizationStatusAuthorized) {
[PHPhotoLibrary requestAuthorization:^(PHAuthorizationStatus status) {
dispatch_async(dispatch_get_main_queue(), ^{
if ([PHPhotoLibrary authorizationStatus] != PHAuthorizationStatusAuthorized) {
[[[UIAlertView alloc] initWithTitle:NSLocalizedString(@"Photo's permission", nil) message:NSLocalizedString(@"Photo not authorized", nil) delegate:nil cancelButtonTitle:nil otherButtonTitles:@"Continue", nil] show];
}
});
}];
}
BOOL background_mode = [instance lpConfigBoolForKey:@"backgroundmode_preference"];
BOOL start_at_boot = [instance lpConfigBoolForKey:@"start_at_boot_preference"];
[self registerForNotifications]; // Register for notifications must be done ASAP to give a chance for first SIP register to be done with right token. Specially true in case of remote provisionning or re-install with new type of signing certificate, like debug to release.