I'm using this piece of code in a sfchat of net maui application to open the camera in android and IOS devices when I click on the camera image attachment
if (DeviceInfo.Current.Platform == DevicePlatform.Android || DeviceInfo.Current.Platform == DevicePlatform.iOS)
{
FileResult myPhoto = await MediaPicker.Default.CapturePhotoAsync();
}
This line of code opens the Android camera to take a picture but not in IOS (Iphone) device
Is there any other way to accomplish this ?
Hi Walter Martin,
We have checked your requirement , we have created a sample with provided code snippet when deploying in iOS we have faced the "Microsoft.Maui.ApplicationModel.FeatureNotSupportedException". in iOS simulator iOS 17.2 also we have analyzed the root cause. we have found that it was restricted by Apple, iOS simulators do not allow access to the Mac camera. we have attached the bug report for this issue. Also, we are checking for device availability to ensure the behavior in iOS to access the camera. We will update with further details on this issue on or before May 24, 2024. We will appreciate it until then.
Bug report:https://github.com/dotnet/maui/issues/7013
Regards,
Suthi Yuvaraj
I installed my application in a phisical Iphone device where I need this function working and I can inform you that also in a phisical device the camera is not opened.
This is a mandatory function for my application so I hope there will be a solution in the phisical device.
Thanks
Walter Martin,
We have reviewed your query and would like to inform you that the difficulty you are experiencing with camera access does not fall within the scope of SfChat's control. The ability to access the camera on both the iOS emulator and actual devices is limited by Apple's restrictions. We have not modified any permissions or access-related code at the source level. For your convenience, we have included the relevant documentation for your reference.
documentation Link :
https://github.com/dotnet/maui/issues/7013
Also kindly ensure that you have provided permission for access the camera and media while deploying the app. Please let us know if you have any concerns