Skip to content

iOS - MediaPicker.PickPhotoAsync() doesn't work if Limited permission (Selected Photos) for Photo Gallery #14973

@MGohil

Description

@MGohil

Maui Team,

In iOS platform, I am not able to pick photo when "Selected Photos" (Limited) permission is given. It does't open any dialog.
If I select "Allow access to All Photos", it works good.

This is how it behaves:

iOS-PhotoPicker-LimitedPermission.mov

Following is my code to pick the file from Gallery and display it on the screen.

App.Current.Dispatcher.Dispatch(async () =>
{
    PermissionStatus status = await CheckAndRequestPhotosPermission();
    if (status == PermissionStatus.Granted || status == PermissionStatus.Limited)
    {
        var imageFile = await MediaPicker.PickPhotoAsync();
        image.Source = ImageSource.FromStream(() => imageFile.OpenReadAsync().Result);
    }
 });

public async Task<PermissionStatus> CheckAndRequestPhotosPermission()
{
    PermissionStatus status = await Permissions.CheckStatusAsync<Permissions.Photos>();
    if (status == PermissionStatus.Granted)
    {
        return status;
    }
    if (status == PermissionStatus.Denied && DeviceInfo.Platform == DevicePlatform.iOS)
    {
        // Prompt the user to turn on in settings On iOS once a
        // permission has been denied it may not be requested again from
        // the application
        return status;
    }
    if (Permissions.ShouldShowRationale<Permissions.Photos>())
    {
    }
    status = await Permissions.RequestAsync<Permissions.Photos>();
    return status;
}

Following is the error log I am getting:

2023-05-08 15:55:52.926498+0530 PickPhoto[14270:294443] [unspecified] container_query_get_single_result: error = 2→(98) NOT_CODESIGNED
2023-05-08 15:55:52.926924+0530 PickPhoto[14270:294443] [unspecified] container_system_group_path_for_identifier: error = ((container_error_t)98) NOT_CODESIGNED
2023-05-08 15:55:52.927023+0530 PickPhoto[14270:294443] [MC] Error getting system group container for systemgroup.com.apple.configurationprofiles: 98
2023-05-08 15:55:52.928180+0530 PickPhoto[14270:294443] [MC] Failed to get profile system group container path. Overriding with expected path: /Users/main/Library/Developer/CoreSimulator/Devices/ECDFFD3D-9C18-498D-985B-A2AAC4DE5DED/data/Containers/Shared/SystemGroup/systemgroup.com.apple.configurationprofiles
2023-05-08 15:55:53.474539+0530 PickPhoto[14270:295053] [lifecycle] [u 4ADA6CAA-EB7A-4DB8-92C0-3D29DA787623:m (null)] [com.apple.mobileslideshow.photo-picker(1.0)] Connection to plugin interrupted while in use.
2023-05-08 15:55:53.477565+0530 PickPhoto[14270:295234] [lifecycle] [u 4ADA6CAA-EB7A-4DB8-92C0-3D29DA787623:m (null)] [com.apple.mobileslideshow.photo-picker(1.0)] Connection to plugin invalidated while in use.
2023-05-08 15:55:53.488591+0530 PickPhoto[14270:294443] viewServiceDidTerminateWithError:: Error Domain=_UIViewServiceInterfaceErrorDomain Code=3 "(null)" UserInfo={Message=Service Connection Interrupted}
2023-05-08 15:55:53.488924+0530 PickPhoto[14270:294443] [UI] -[PUPhotoPickerHostViewController viewServiceDidTerminateWithError:] Error Error Domain=_UIViewServiceInterfaceErrorDomain Code=3 "(null)" UserInfo={Message=Service Connection Interrupted}
Thread started:  #11
2023-05-08 15:55:54.202255+0530 PickPhoto[14270:295236] [assertion] Error acquiring assertion: <Error Domain=RBSAssertionErrorDomain Code=2 "Specified target process does not exist" UserInfo={NSLocalizedFailureReason=Specified target process does not exist}>
2023-05-08 15:55:55.551462+0530 PickPhoto[14270:294443] [Presentation] Attempt to present <UIImagePickerController: 0x7f8b10e2b200> on <UIImagePickerController: 0x7f8b10d55400> (from <UIImagePickerController: 0x7f8b10d55400>) whose view is not in the window hierarchy.
2023-05-08 15:55:57.542245+0530 PickPhoto[14270:294443] Attempt to present <UIImagePickerController: 0x7f8b0caca000> on <Microsoft_Maui_Platform_PageViewController: 0x7f8b09f3a3a0> which is waiting for a delayed presention of <UIImagePickerController: 0x7f8b10e2a600> to complete
2023-05-08 15:55:57.577673+0530 PickPhoto[14270:295236] [lifecycle] [u 4ADA6CAA-EB7A-4DB8-92C0-3D29DA787623:m (null)] [com.apple.mobileslideshow.photo-picker(1.0)] Connection to plugin interrupted while in use.
2023-05-08 15:55:57.580077+0530 PickPhoto[14270:294443] viewServiceDidTerminateWithError:: Error Domain=_UIViewServiceInterfaceErrorDomain Code=3 "(null)" UserInfo={Message=Service Connection Interrupted}
2023-05-08 15:55:57.580291+0530 PickPhoto[14270:294443] [UI] -[PUPhotoPickerHostViewController viewServiceDidTerminateWithError:] Error Error Domain=_UIViewServiceInterfaceErrorDomain Code=3 "(null)" UserInfo={Message=Service Connection Interrupted}
2023-05-08 15:55:57.581287+0530 PickPhoto[14270:294443] viewServiceDidTerminateWithError:: Error Domain=_UIViewServiceInterfaceErrorDomain Code=3 "(null)" UserInfo={Message=Service Connection Interrupted}
2023-05-08 15:55:57.581530+0530 PickPhoto[14270:294443] [UI] -[PUPhotoPickerHostViewController viewServiceDidTerminateWithError:] Error Error Domain=_UIViewServiceInterfaceErrorDomain Code=3 "(null)" UserInfo={Message=Service Connection Interrupted}
2023-05-08 15:56:01.988585+0530 PickPhoto[14270:295075] [assertion] Error acquiring assertion: <Error Domain=RBSAssertionErrorDomain Code=2 "Specified target process does not exist" UserInfo={NSLocalizedFailureReason=Specified target process does not exist}>
2023-05-08 15:56:02.017385+0530 PickPhoto[14270:294443] Attempt to present <UIImagePickerController: 0x7f8b0d10b000> on <Microsoft_Maui_Platform_PageViewController: 0x7f8b09f3a3a0> which is waiting for a delayed presention of <UIImagePickerController: 0x7f8b1173f400> to complete
2023-05-08 15:56:02.020097+0530 PickPhoto[14270:295075] [assertion] Error acquiring assertion: <Error Domain=RBSAssertionErrorDomain Code=2 "Specified target process does not exist" UserInfo={NSLocalizedFailureReason=Specified target process does not exist}>
2023-05-08 15:56:03.832321+0530 PickPhoto[14270:295425] [lifecycle] [u 4ADA6CAA-EB7A-4DB8-92C0-3D29DA787623:m (null)] [com.apple.mobileslideshow.photo-picker(1.0)] Connection to plugin interrupted while in use.
2023-05-08 15:56:03.834078+0530 PickPhoto[14270:295427] [lifecycle] [u 4ADA6CAA-EB7A-4DB8-92C0-3D29DA787623:m (null)] [com.apple.mobileslideshow.photo-picker(1.0)] Connection to plugin invalidated while in use.
2023-05-08 15:56:03.840211+0530 PickPhoto[14270:294443] viewServiceDidTerminateWithError:: Error Domain=_UIViewServiceInterfaceErrorDomain Code=3 "(null)" UserInfo={Message=Service Connection Interrupted}
2023-05-08 15:56:03.840409+0530 PickPhoto[14270:294443] [UI] -[PUPhotoPickerHostViewController viewServiceDidTerminateWithError:] Error Error Domain=_UIViewServiceInterfaceErrorDomain Code=3 "(null)" UserInfo={Message=Service Connection Interrupted}
2023-05-08 15:56:03.840616+0530 PickPhoto[14270:294443] viewServiceDidTerminateWithError:: Error Domain=_UIViewServiceInterfaceErrorDomain Code=3 "(null)" UserInfo={Message=Service Connection Interrupted}
2023-05-08 15:56:03.840744+0530 PickPhoto[14270:294443] [UI] -[PUPhotoPickerHostViewController viewServiceDidTerminateWithError:] Error Error Domain=_UIViewServiceInterfaceErrorDomain Code=3 "(null)" UserInfo={Message=Service Connection Interrupted}

Tools:
Visual Studio Professional 2022 for Mac Preview: Version 17.6 Preview (17.6 build 1496)
Runtime:.NET 7.0.3 (64-bit)
Operating System: Mac OS X 13.3.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-essentialsEssentials: Device, Display, Connectivity, Secure Storage, Sensors, App Infop/1Work that is important, and has been scheduled for release in this or an upcoming sprintpartner/cat 😻this is an issue that impacts one of our partners or a customer our advisory team is engaged withplatform/ioss/triagedIssue has been reviewedt/bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions