Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Maui MediaPicker.Default.CapturePhotoAsync fails under iOS with no error message #23197

Closed
grantsss opened this issue Jun 22, 2024 · 5 comments
Closed
Labels
area-essentials Essentials: Device, Display, Connectivity, Secure Storage, Sensors, App Info platform/iOS 🍎 potential-regression This issue described a possible regression on a currently supported version., verification pending s/needs-repro Attach a solution or code which reproduces the issue t/bug Something isn't working

Comments

@grantsss
Copy link

Description

Hi,

When I try to capture an image on a physical Apple device using MediaPicker.Default.CapturePhotoAsync() the calling function stops functioning with no error message and returns a null.

My project is running the following packages:

I am getting the same results on a iPhone 8 running iOS 16.3.1 and a iPad Air 2 running iOS 15.8.2.

Works under Windows and Android.

Thanks for your help,

Grant

Steps to Reproduce

When I try to capture an image on a physical Apple device using MediaPicker.Default.CapturePhotoAsync() the calling function stops functioning with no error message and returns a null.

Code sample:

    public async Task<List<Photo>> TakePic(ContentPage page)
    {
        var Photos = new List<Photo>();

        Photo photo = new Photo();

        try
        {
            await page.DisplayAlert("Debug", $"IsCaptureSupported {MediaPicker.Default.IsCaptureSupported}", "Ok");
            if (MediaPicker.Default.IsCaptureSupported)
            {
                await page.DisplayAlert("Debug", $"taking pic", "Ok");

                var photoFile = await MediaPicker.Default.CapturePhotoAsync();


                if (photoFile != null) /iOS returns null here?

Link to public reproduction project repository

No response

Version with bug

8.0.6 SR1

Is this a regression from previous behavior?

Yes, this used to work in .NET MAUI

Last version that worked well

Unknown/Other

Affected platforms

iOS

Affected platform versions

iPhone 8 running iOS 16.3.1 and a iPad Air 2 running iOS 15.8.2

Did you find any workaround?

No

Relevant log output

No exceptions raised, just a null FielResult returned.

Works perfectly under Windows and Android
@grantsss grantsss added the t/bug Something isn't working label Jun 22, 2024
Copy link
Contributor

Hi I'm an AI powered bot that finds similar issues based off the issue title.

Please view the issues below to see if they solve your problem, and if the issue describes your problem please consider closing this one and thumbs upping the other issue to help us prioritize it. Thank you!

Open similar issues:

Closed similar issues:

Note: You can give me feedback by thumbs upping or thumbs downing this comment.

@PureWeen PureWeen added the potential-regression This issue described a possible regression on a currently supported version., verification pending label Jun 24, 2024
@DCorrBECare
Copy link

Hi @grantsss, does it works if you call the CapturePhotoAsync inside the MainThread.InvokeOnMainThreadAsync?

@PureWeen PureWeen added the area-essentials Essentials: Device, Display, Connectivity, Secure Storage, Sensors, App Info label Jun 28, 2024
@grantsss
Copy link
Author

grantsss commented Jul 9, 2024 via email

@PureWeen PureWeen added the s/needs-repro Attach a solution or code which reproduces the issue label Jul 11, 2024
Copy link
Contributor

Hi @grantsss. We have added the "s/needs-repro" label to this issue, which indicates that we require steps and sample code to reproduce the issue before we can take further action. Please try to create a minimal sample project/solution or code samples which reproduce the issue, ideally as a GitHub repo that we can clone. See more details about creating repros here: https://github.com/dotnet/maui/blob/main/.github/repro.md

This issue will be closed automatically in 7 days if we do not hear back from you by then - please feel free to re-open it if you come back to this issue after that time.

Copy link
Contributor

This issue has been automatically marked as stale because it has been marked as requiring author feedback to reproduce the issue but has not had any activity for 4 days. It will be closed if no further activity occurs within 3 days of this comment. If it is closed, feel free to comment when you are able to provide the additional information and we will re-investigate.

@dotnet-policy-service dotnet-policy-service bot added the s/no-recent-activity Issue has had no recent activity label Jul 15, 2024
@github-actions github-actions bot locked and limited conversation to collaborators Aug 18, 2024
@dotnet-policy-service dotnet-policy-service bot removed the s/no-recent-activity Issue has had no recent activity label Aug 18, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-essentials Essentials: Device, Display, Connectivity, Secure Storage, Sensors, App Info platform/iOS 🍎 potential-regression This issue described a possible regression on a currently supported version., verification pending s/needs-repro Attach a solution or code which reproduces the issue t/bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants