Skip to content
This repository has been archived by the owner on May 5, 2020. It is now read-only.

Commit

Permalink
Merge pull request fuse-open#1208 from LuisRodriguezLD/master
Browse files Browse the repository at this point in the history
fix iOS Camera roll permission issue
  • Loading branch information
kusma authored Aug 12, 2018
2 parents fd2708c + 9fdf579 commit 60b38de
Showing 1 changed file with 18 additions and 5 deletions.
23 changes: 18 additions & 5 deletions Source/Fuse.CameraRoll/iOS/iOSCameraRoll.uno
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,24 @@ namespace Fuse.CameraRoll
[Foreign(Language.ObjC)]
static void SelectPictureInternal(Action<string> onComplete, Action<string> onFail)
@{
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
[[CameraRollHelper instance] selectPictureWithCompletionHandler:onComplete onFail:onFail];
});
PHAuthorizationStatus status = [PHPhotoLibrary authorizationStatus];
if (status == PHAuthorizationStatusNotDetermined)
[PHPhotoLibrary requestAuthorization:^(PHAuthorizationStatus status){
if (status == PHAuthorizationStatusAuthorized)
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
[[CameraRollHelper instance] selectPictureWithCompletionHandler:onComplete onFail:onFail];
});
else
onFail(@"PHAuthorizationStatusDenied");
}];
else if (status == PHAuthorizationStatusAuthorized)
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
[[CameraRollHelper instance] selectPictureWithCompletionHandler:onComplete onFail:onFail];
});
else if (status == PHAuthorizationStatusRestricted)
onFail(@"PHAuthorizationStatusRestricted");
else if (status == PHAuthorizationStatusDenied)
onFail(@"PHAuthorizationStatusDenied");
@}


}
}

0 comments on commit 60b38de

Please sign in to comment.