-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>
但我總是得到一個「訪問被拒絕」的錯誤,當我」調試。 我在拍攝照片後使用了C#代碼,因爲我需要將其轉換爲Base64,並且我得到了一些教程,我必須先保存圖像,然後使用流等,或者您有更好的解決方案來轉換圖像到Base64。我需要Base64通過使用HttpClient的POST方法將圖片發送到Web API。
Hi @Pawel,歡迎來到StackOverflow!爲了幫助S.O.用戶,你的問題的清晰度很重要。我相信除了「訪問被拒絕」錯誤之外,你還需要做幾件事情。請編輯您的問題並將其分解。如果您可以指定迄今已嘗試過的解決方案,它也將有所幫助。乾杯! –