1
我已經從網絡服務下載圖像,並且需要在Safari內打開圖像或將其保存到相機膠捲。我試圖在Safari中打開圖像,但Safari瀏覽器無法打開。用圖像啓動Safari或保存到相機膠捲問題
var safari = UIApplication.SharedApplication;
var uri = new NSUrl(path); // where the image is saved to
safari.OpenUrl(uri);
這編譯,但Safari瀏覽器沒有啓動
我必須保存至相機膠捲中的代碼是這樣的
PHPhotoLibrary.SharedPhotoLibrary.PerformChanges(() =>
{
using (var pool3 = new NSAutoreleasePool())
{ pool3.InvokeOnMainThread(delegate()
{ PHAssetChangeRequest.FromImage((UIImage)UIImage.FromFile(path));
});
}
}, (t, err) =>
{
if (!t)
{
using (var pool1 = new NSAutoreleasePool())
{
pool1.InvokeOnMainThread(delegate() {
var alert = new UIAlertView("Error saving file", "An error has occured saving your photo to the camera roll", null, "OK");
alert.Show();
};
}
else
{
using (var pool2 = new NSAutoreleasePool())
{
pool2.InvokeOnMainThread(delegate(){
var alert = new UIAlertView("Image saved", "Your image has been saved to the camera roll", null, "OK");
alert.Show();
});
};
}
});
其崩潰和燒傷(正確的權限已設置)
我不知道爲什麼這些工作看起來都是正確的。