How to give Permission for Camera used in iOS App with Xamarin forms.

RakeshSainiRakeshSaini INMember ✭✭
edited July 2017 in Xamarin.Forms

Hi , I need to used Camera and Photos in my App . I am using Xamarin forms.
Camera and Photos Library Access working fine in Android App . But not in iOS App.
is There anyone know , how can i used Camera and Photos for iOS App?

Thanks !!

Best Answer

Answers

  • hitshits Member ✭✭

    I have these permission but i still seem to be getting an error "plugin.media.abstractions.mediapermissionexception: camera permission(s) are required."

    Don't get the Permission dialog just an error ... What am I missing??

  • divyagarimelladivyagarimella Member ✭✭

    Hi
    In my case it is asking permission when i click on gallery icon but if i click on "Don't Allow",even it's accessing photos

  • chetanrawatchetanrawat USMember ✭✭

    @divyagarimella
    In your case you should ask for permission before entering Gallary page.

  • NMackayNMackay GBInsider, University mod

    @chetanrawat said:
    @divyagarimella
    In your case you should ask for permission before entering Gallary page.

    Yeah,

    This is the way to do it, also don't ask for all your permissions up front when you start that app, ask for then as you need them.

  • divyagarimelladivyagarimella Member ✭✭

    yes i am asking for permission before entering to gallery page.still it accessing photos . i think i am testing it in simulator not in device .is it because of that reason?

  • divyagarimelladivyagarimella Member ✭✭

    my code is like this in xamarin forms ios project
    if (!CrossMedia.Current.IsPickPhotoSupported)
    {
    await DisplayAlert(TaskyeConstants.PHOTOSNOTSUPPORTED, TaskyeConstants.NOPERMISSION, TaskyeConstants.OK);
    return;
    }

                var file = await Plugin.Media.CrossMedia.Current.PickPhotoAsync(new Plugin.Media.Abstractions.PickMediaOptions
                {
                    PhotoSize = Plugin.Media.Abstractions.PhotoSize.Small,
                    CompressionQuality = 50,
                    RotateImage = true,
                    MaxWidthHeight = 50,
                });
    
                if (file == null)
                    return;
    

    i am giving permissions in Info.plist(these two permissions for gallery NSPhotoLibraryAddUsageDescription,NSPhotoLibraryUsageDescription
    and for camera i am giving NSCameraUsageDescription

Sign In or Register to comment.