Skip to content
This repository has been archived by the owner on Jul 5, 2024. It is now read-only.

ArgumentNullException on iOS #545

Closed
CesareSoldani opened this issue May 17, 2018 · 6 comments
Closed

ArgumentNullException on iOS #545

CesareSoldani opened this issue May 17, 2018 · 6 comments

Comments

@CesareSoldani
Copy link

Bug Information

Version Number of Plugin: 3.1.3
Device Tested On: iPad
Simulator Tested On:
Version of VS: 2017
Version of Xamarin: 2.5.1.444934
Versions of other things you are using:

Steps to reproduce the Behavior

        if (!CrossMedia.Current.IsPickPhotoSupported)
        {
            App.DisplayAlert("Photos Not Supported", ":( Permission not granted to photos.", "OK");
            return;
        }

        var file = await Plugin.Media.CrossMedia.Current.PickPhotoAsync(new Plugin.Media.Abstractions.PickMediaOptions
        {
            PhotoSize = Plugin.Media.Abstractions.PhotoSize.Medium,

        });

Expected Behavior

Actual Behavior

Image picker is displayed, but once you select an image...

2018-05-17 12:16:10.141 SkiaDraw.iOS[350:31646] Unable to get metadata: System.ArgumentNullException: Value cannot be null.
Parameter name: asset
at Photos.PHImageManager.RequestImageData (Photos.PHAsset asset, Photos.PHImageRequestOptions options, Photos.PHImageDataHandler handler) [0x00087] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.10.1.177/src/Xamarin.iOS/Photos/PHImageManager.g.cs:169
at Plugin.Media.PhotoLibraryAccess.GetPhotoLibraryMetadata (Foundation.NSUrl url) [0x0004c] in :0
at Plugin.Media.MediaPickerDelegate+d__25.MoveNext () [0x00305] in :0

Code snippet

Screenshots

@Vladis466
Copy link

Vladis466 commented Jun 20, 2018

Verified, same behavior using 4.0.0.9 and 3.1.3.

Video upload from library works fine.

Running on iOS 11.4

@lucky-c
Copy link

lucky-c commented Aug 2, 2018

Same, this bug also happen on 3.1.2 but only on iOS.
For temporary workaround for this issue, you can set SaveMetaData for PickMediaOptions to false.

@jamesmontemagno
Copy link
Owner

What is in your info.plist?

@CesareSoldani
Copy link
Author

CesareSoldani commented Aug 3, 2018

`

UIDeviceFamily 1 2 UISupportedInterfaceOrientations UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight UISupportedInterfaceOrientations~ipad UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight MinimumOSVersion 11.3 CFBundleDisplayName SkiaDraw CFBundleIdentifier com.companyname.SkiaDraw CFBundleVersion 1.0 CFBundleIconFiles Icon-60@2x Icon-60@3x Icon-76 Icon-76@2x Default Default@2x Default-568h@2x Default-Portrait Default-Portrait@2x Icon-Small-40 Icon-Small-40@2x Icon-Small-40@3x Icon-Small Icon-Small@2x Icon-Small@3x UILaunchStoryboardName LaunchScreen NSCameraUsageDescription This app needs access to the camera to take photos. NSPhotoLibraryUsageDescription This app needs access to photos. NSMicrophoneUsageDescription This app needs access to microphone. NSPhotoLibraryAddUsageDescription This app needs access to the photo gallery. `

Hmm, wont let me paste xml nicely, what are you looking for?

@K232
Copy link

K232 commented Sep 5, 2018

Same here with 4.0.1.5 on iOS

Unable to get metadata: System.ArgumentNullException: Value cannot be null.
Parameter name: asset
at Photos.PHImageManager.RequestImageData (Photos.PHAsset asset, Photos.PHImageRequestOptions options, Photos.PHImageDataHandler handler) [0x00003] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.14.0.14/src/Xamarin.iOS/Photos/PHImageManager.g.cs:152
at Plugin.Media.PhotoLibraryAccess.GetPhotoLibraryMetadata (Foundation.NSUrl url) [0x0004c] in <390f35b1db5e43b894d803204ceef8a9>:0
at Plugin.Media.MediaPickerDelegate+d__25.MoveNext () [0x00319] in <390f35b1db5e43b894d803204ceef8a9>:0

Using SaveMetaData = false as propose by @lucky-c fixed it, thanks!

@ltbao472
Copy link

Same, this bug also happen on 3.1.2 but only on iOS.
For temporary workaround for this issue, you can set SaveMetaData for PickMediaOptions to false.

Thanks @lucky-c, it worked for me.

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