2016-05-16 10 views
-1

拒否された:UWP - - 画像ライブラリーは、アクセスが、私は次のコードしている

FileSavePicker savePicker = new FileSavePicker(); 
savePicker.FileTypeChoices.Add("Plain Text", new List<string>() { ".txt" }); 
savePicker.SuggestedStartLocation = PickerLocationId.PicturesLibrary; 
savePicker.SuggestedFileName = "New Document"; 
savePicker.SuggestedSaveFile = photo; 
await savePicker.PickSaveFileAsync(); 

と私appxmanifestは、次のようになります。

<?xml version="1.0" encoding="utf-8"?> 
<Package xmlns="http://schemas.microsoft.com/appx/manifest/foundation/windows10" xmlns:mp="http://schemas.microsoft.com/appx/2014/phone/manifest" xmlns:uap="http://schemas.microsoft.com/appx/manifest/uap/windows10" IgnorableNamespaces="uap mp"> 
    <Identity Name="" Publisher="" Version="1.0.0.0" /> 
    <mp:PhoneIdentity PhoneProductId="" PhonePublisherId="00000000-0000-0000-0000-000000000000" /> 
    <Properties> 
    <DisplayName></DisplayName> 
    <PublisherDisplayName></PublisherDisplayName> 
    <Logo>Assets\StoreLogo.png</Logo> 
    </Properties> 
    <Dependencies> 
    <TargetDeviceFamily Name="Windows.Universal" MinVersion="10.0.0.0" MaxVersionTested="10.0.0.0" /> 
    </Dependencies> 
    <Resources> 
    <Resource Language="x-generate" /> 
    </Resources> 
    <Applications> 
    <Application Id="App" Executable="$targetnametoken$.exe" EntryPoint="zalegaNaMagazynie.App"> 
     <uap:VisualElements DisplayName="" Square150x150Logo="Assets\Square150x150Logo.png" Square44x44Logo="Assets\Square44x44Logo.png" Description="" BackgroundColor="transparent"> 
     <uap:DefaultTile Wide310x150Logo="Assets\Wide310x150Logo.png"> 
     </uap:DefaultTile> 
     <uap:SplashScreen Image="Assets\SplashScreen.png" /> 
     </uap:VisualElements> 
    </Application> 
    </Applications> 
    <Capabilities> 
    <Capability Name="internetClient" /> 
    <uap:Capability Name="picturesLibrary" /> 
    <uap:Capability Name="removableStorage" /> 
    <DeviceCapability Name="webcam" /> 
    </Capabilities> 
</Package> 

しかし、私はいつも私が「「アクセスが拒否されました」エラーが出ますmデバッグ。 私はこのコードをBase64に変換する必要があるため、写真を撮った後で使用しています。まず、画像を保存してからストリームなどを使用する必要があるチュートリアルがあります。 Base64へ。私はHttpClientを使ってPOSTメソッドを通してWeb APIに画像を送るためにBase64が必要です。

+0

こんにちは@Pawel、StackOverflowへようこそ! S.O.を支援する。あなたの質問の明快さは重要です。私は 'Access Denied'エラー以外のいくつかのことを求めていると思います。質問を編集して解読してください。あなたがこれまでに試した解決策を指定することができれば助けになります。乾杯! –

答えて

0

ローカルフォルダにファイルを保存できます。マニフェストにはそのための機能は必要ありません。

StorageFile sf = await ApplicationData.Current.LocalFolder.CreateFileAsync("filename.txt"); 

ところで、小さなファイルを送信する場合は、HttpClientを使用できます。大規模なデータにはお勧めできません。

関連する問題