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:
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,
});
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
at Plugin.Media.MediaPickerDelegate+
Verified, same behavior using 4.0.0.9 and 3.1.3.
Video upload from library works fine.
Running on iOS 11.4
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.
What is in your info.plist?
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>UIDeviceFamily</key>
<array>
<integer>1</integer>
<integer>2</integer>
</array>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>UISupportedInterfaceOrientations~ipad</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationPortraitUpsideDown</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>MinimumOSVersion</key>
<string>11.3</string>
<key>CFBundleDisplayName</key>
<string>SkiaDraw</string>
<key>CFBundleIdentifier</key>
<string>com.companyname.SkiaDraw</string>
<key>CFBundleVersion</key>
<string>1.0</string>
<key>CFBundleIconFiles</key>
<array>
<string>Icon-60@2x</string>
<string>Icon-60@3x</string>
<string>Icon-76</string>
<string>Icon-76@2x</string>
<string>Default</string>
<string>Default@2x</string>
<string>Default-568h@2x</string>
<string>Default-Portrait</string>
<string>Default-Portrait@2x</string>
<string>Icon-Small-40</string>
<string>Icon-Small-40@2x</string>
<string>Icon-Small-40@3x</string>
<string>Icon-Small</string>
<string>Icon-Small@2x</string>
<string>Icon-Small@3x</string>
</array>
<key>UILaunchStoryboardName</key>
<string>LaunchScreen</string>
</dict>
<key>NSCameraUsageDescription</key>
<string>This app needs access to the camera to take photos.</string>
<key>NSPhotoLibraryUsageDescription</key>
<string>This app needs access to photos.</string>
<key>NSMicrophoneUsageDescription</key>
<string>This app needs access to microphone.</string>
<key>NSPhotoLibraryAddUsageDescription</key>
<string>This app needs access to the photo gallery.</string>
</plist>
Hmm, wont let me paste xml nicely, what are you looking for?
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+
Using _SaveMetaData = false_ as propose by @lucky-c fixed it, thanks!
Same, this bug also happen on 3.1.2 but only on iOS.
For temporary workaround for this issue, you can setSaveMetaDataforPickMediaOptionsto false.
Thanks @lucky-c, it worked for me.
Most helpful comment
Same, this bug also happen on 3.1.2 but only on iOS.
For temporary workaround for this issue, you can set
SaveMetaDataforPickMediaOptionsto false.