简体   繁体   中英

Method “TakePhotoAsync” of Xam.Plugin.Media return null on platform WinPhone in Xamarin.Forms

I'm new to Xamarin and Xamarin Forms. I do not understand how come the method "TakePhotoAsync" of plugin Xam.Plugin.Media return null lifting up a System.NullReferenceException. Variable media is correctly initialized. This is part of the code:

var file = await media.TakePhotoAsync(new StoreCameraMediaOptions
                {
                    DefaultCamera = CameraDevice.Rear,
                    Directory = "TestPhoto",
                    Name = "Photo.jpg",
                    SaveToAlbum = true
                });

Exactly variable file is null, why?!

Due to this link you have to do next thing: 在此处输入图片说明

Updated

Components

在此处输入图片说明 在此处输入图片说明

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM