Skip to content
This repository has been archived by the owner on Apr 3, 2023. It is now read-only.

[BUG] RequestPermissionAsync<>() in XCode12/IOS14 not returning any value. #185

Open
SteveGrixti-Remax opened this issue Oct 8, 2020 · 6 comments

Comments

@SteveGrixti-Remax
Copy link

SteveGrixti-Remax commented Oct 8, 2020

Bug Information

Version Number of Plugin: 6.0.1
Device Tested On: N/A
Simulator Tested On: iPhone 11 Pro Max iOS 14.0 Simulator (Mac)
Version of VS: 8.7.8
Version of Xamarin: 4.8.0.1534

Steps to reproduce the Behavior

  1. Check if the app has access to the users location/storage etc..
  2. If permission is not granted, request permission from user.

Expected Behavior

  1. The user give permissions for the app to access the requested resource.
  2. The app continues as neccessary.

Actual Behavior

  1. The user give permissions for the app to access the requested resource.
  2. The app receives no response from the method RequestPermissionAsync and so the encapsulated method cannot continue.

Code snippet

public LoadingPage() {
  InitializeComponent();
}

protected override async void OnAppearing() {
  base.OnAppearing();

  bool permissionsGranted = await CheckAndRequestPermissions();

  if (permissionsGranted) {
    //Continue
  }
}

public async Task<bool> CheckAndRequestPermissions() {
  List<string> permissionsNotGranted = new List<string> ();

  PermissionStatus locationStatus = await CrossPermissions.Current.CheckPermissionStatusAsync<LocationPermission> ();

  if (locationStatus != PermissionStatus.Granted) {
    PermissionStatus requestLocationPermission = await CrossPermissions.Current.RequestPermissionAsync<LocationPermission> ();

    if (requestLocationPermission.HasFlag(PermissionStatus.Denied)) permissionsNotGranted.Add("location");
  }

  PermissionStatus storageReadStatus = await CrossPermissions.Current.CheckPermissionStatusAsync<StoragePermission> ();

  if (storageReadStatus != PermissionStatus.Granted) {
    PermissionStatus requestStoragePermission = await CrossPermissions.Current.RequestPermissionAsync<StoragePermission> ();

    if (requestStoragePermission.HasFlag(PermissionStatus.Denied)) permissionsNotGranted.Add("storage");
  }

  return permissionsNotGranted.Count() == 0;
}

Note

  • This issue began to occur ever since updating Visual Studio, XCode and Xamarin to the latest versions.

  • Currently the app is live on devices using both Android and iOS however they were compiled using the previous versions and are still working for now. I can't release any updates until the issue has been fixed however.

@SangI762
Copy link

SangI762 commented Oct 15, 2020

Have the same issue. Works on iOS 14.2 beta and iOS 13.7, but doesn't work on ios 14.0.1
Any time frame when it could be fixed?

@SteveGrixti-Remax
Copy link
Author

I am bumping this issue as it is quite a showstopper for us. Any news?

@EmmanVazz
Copy link

This issue is fixed in Xamarin Essentials preview.
xamarin/Essentials#1390

@chrisfoulds
Copy link

i moved to the latest beta of essentials which fixes this - was a 15-20 min effort and can confirm it works on 13.x and 14.x

@sisaacks
Copy link

sisaacks commented Feb 9, 2021

Hello....I am still having this issue on IOS 14 with Iphone 11. I have updated to the latest Xamarin, IOS, and VS

@Lelelo1
Copy link

Lelelo1 commented Feb 13, 2021

Hello....I am still having this issue on IOS 14 with Iphone 11. I have updated to the latest Xamarin, IOS, and VS

Same

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants