簡體   English   中英

FileOpenPicker無法使用PhoneGap運行Windows Phone 8.1

[英]FileOpenPicker not working windows phone 8.1 using phonegap

我試圖通過使用phonegap在Windows Phone 8.1中使用FileOpenPicker來選擇文件,但是它不起作用。

我用這個代碼

public class Echo : BaseCommand { public void echo(string options) { try{ FileOpenPicker openPicker = new FileOpenPicker(); openPicker.ViewMode = PickerViewMode.Thumbnail; openPicker.SuggestedStartLocation = PickerLocationId.PicturesLibrary; openPicker.FileTypeFilter.Add(".jpg"); openPicker.FileTypeFilter.Add(".jpeg"); openPicker.FileTypeFilter.Add(".png"); StorageFile file = await openPicker.PickSingleFileAsync(); if (file != null){ DispatchCommandResult(new PluginResult(PluginResult.Status.OK, "Picked photo: " + file.Name)); } else{ DispatchCommandResult(new PluginResult(PluginResult.Status.OK, "Operation cancelled")); } }catch (Exception e){ DispatchCommandResult(new PluginResult(PluginResult.Status.ERROR, "Error=>"+e.ToString())); } } }

在電話間隙中

cordova.exec(success, error, "Echo", "echo"); function success(message) { //upload_file(message); alert(message); } function error(e) { alert(e); }

但是我收到這樣的錯誤

在此處輸入圖片說明

誰能指導我.....

提前致謝。

有時MSDN文檔可能非常混亂。

PickSingleFileAsync(); // is not supported

而是嘗試以下方法:

PickSingleFileAndContinue();

MSDN PickSingleFileAndContinue


在此處輸入圖片說明

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM