这是我的代码。
MediaLibrary myMediaLibrary = new MediaLibrary();
Uri myUri = new Uri(@"Images/Jellyfish.jpg", UriKind.Relative);
System.IO.Stream photoStream = App.GetResourceStream(myUri).Stream;
byte[] buffer = new byte[photoStream.Length];
photoStream.Read(buffer, 0, Convert.ToInt32(photoStream.Length));
myMediaLibrary.SavePicture("Jellyfish.jpg", buffer);
在模拟器上,一切都被保存了。但在设备上显示错误“发生意外错误”。