Xamarin - FFImageLoading - System.IO.IOException



我的XAML文件中有以下内容:

<ContentPage.Content>
<AbsoluteLayout HorizontalOptions="FillAndExpand" VerticalOptions="FillAndExpand">
<StackLayout
AbsoluteLayout.LayoutFlags="All"
AbsoluteLayout.LayoutBounds="0,0,1,1">
<service:PinchPanContainer HorizontalOptions="FillAndExpand" VerticalOptions="FillAndExpand">
<ffimageloading:CachedImage RetryCount="5" RetryDelay="1" CacheDuration="1" x:Name="MyImage" HorizontalOptions="Fill" VerticalOptions="CenterAndExpand" DownsampleToViewSize="False"></ffimageloading:CachedImage>
</service:PinchPanContainer>                
</StackLayout>
<StackLayout BindingContext="{x:Reference MyImage}" IsVisible="{Binding IsLoading}" Padding="12"
AbsoluteLayout.LayoutFlags="PositionProportional"
AbsoluteLayout.LayoutBounds="0.5,0.5,-1,-1">
<ActivityIndicator BindingContext="{x:Reference MyImage}" IsRunning="{Binding IsLoading}" />
<Label Text="Loading Hi-Res Image..." BindingContext="{x:Reference MyImage}" IsVisible="{Binding IsLoading}" HorizontalOptions="Center" TextColor="Black"/>
</StackLayout>
</AbsoluteLayout>
</ContentPage.Content>

并使用它来定义图像源:

MyImage.Source = uri;

Uri具有此值,并且图像在浏览器中正确加载:http://192.168.0.12/images/27kv4c1/2dbc5331/a08a31/IMG_4190-Modifica.png

但在模拟中,一旦我分配了源,我就会得到5倍的错误:

03-30 21:06:12.525 I/mono-stdout(28576): ---> (Inner Exception #5) System.IO.IOException: The server returned an invalid or unrecognized response.
03-30 21:06:12.525 I/mono-stdout(28576):   at System.Net.Http.HttpConnection+ContentLengthReadStream.ReadAsync (System.Memory`1[T] buffer, System.Threading.CancellationToken cancellationToken) [0x00171] in /Users/builder/jenkins/workspace/archive-mono/2019-10/android/release/external/corefx/src/System.Net.Http/src/System/Net/Http/SocketsHttpHandler/ContentLengthReadStream.cs:70 
03-30 21:06:12.525 I/mono-stdout(28576):   at FFImageLoading.Cache.DownloadCache.DownloadAsync (System.String url, System.Threading.CancellationToken token, System.Net.Http.HttpClient client, FFImageLoading.Work.TaskParameter parameters, FFImageLoading.DownloadInformation downloadInformation) [0x00652] in C:projectsffimageloadingsourceFFImageLoading.CommonCacheDownloadCache.cs:163 
03-30 21:06:12.525 I/mono-stdout(28576):   at FFImageLoading.Cache.DownloadCache+<>c__DisplayClass15_0.<DownloadAndCacheIfNeededAsync>b__0 () [0x00050] in C:projectsffimageloadingsourceFFImageLoading.CommonCacheDownloadCache.cs:58 
03-30 21:06:12.525 I/mono-stdout(28576):   at FFImageLoading.Retry.DoAsync[T] (System.Func`1[TResult] action, System.TimeSpan retryInterval, System.Int32 retryCount, System.Action onRetry) [0x00047] in C:projectsffimageloadingsourceFFImageLoading.CommonHelpersRetry.cs:19 <---

可能是什么原因造成的?

问题是我使用的是来自laravel的php artisan serve。切换到Apache(从examplep(解决了这个问题。

相关内容

  • 没有找到相关文章

最新更新