简体   繁体   English

FFImageLoading 在执行真实设备时无法加载大 Gif 文件

[英]FFImageLoading fails load big Gif file when executing real device

My Xamarin.Forms app uses FFImageLoading for loading three Gifs.我的 Xamarin.Forms 应用程序使用 FFImageLoading 加载三个 Gif。

  • A.gif: 3.7MB A.gif:3.7MB
  • B.gif: 5.1MB B.gif:5.1MB
  • C.gif: 2MB C.gif:2MB

(These Gifs created by DavinciResolve) (这些 Gif 由 DavinciResolve 创建)

My app preload Gifs as following.我的应用程序按如下方式预加载 Gif。

public static async void PreloadTutorialGifs()
{
    try
    {
        var targetWidth = 500;
        var targetHeight = 1000;
        await ImageService.Instance.LoadFileFromApplicationBundle("A.gif").Success((info, result) =>
        {
            Debug.WriteLine($"A.gif Preloading finished! Key: {info.CacheKey}");
        })
        .CacheKey("A.gif")
        .DownSample(targetWidth, targetHeight)
        .PreloadAsync();
        await ImageService.Instance.LoadFileFromApplicationBundle("B.gif").Success((info, result) =>
        {
            Debug.WriteLine($"B.gif Preloading finished! Key: {info.CacheKey}");
        })
        .CacheKey("B.gif")
        .DownSample(targetWidth, targetHeight)
        .PreloadAsync();
        await ImageService.Instance.LoadFileFromApplicationBundle("C.gif").Success((info, result) =>
        {
            Debug.WriteLine($"C.gif Preloading finished! Key: {info.CacheKey}");
        })
        .CacheKey("C.gif")
        .DownSample(targetWidth, targetHeight)
        .PreloadAsync();
    }
    catch (Exception ex)
    {
        Console.WriteLine(ex.Message);
        Utility.SendExceptionToCrashlytics(ex);
    }
}

[ simulator output] [模拟器输出]

2022-12-20 09:02:05.134347+0900 SoccerScoreApp.iOS[53533:1012657] FFImageLoading log: Image memory cache size: 3276.8 MB
2022-12-20 09:02:05.505321+0900 SoccerScoreApp.iOS[53533:1013047] FFImageLoading log: Generating/retrieving image: A.gif
A.gif Preloading finished! Key: A.gif
2022-12-20 09:02:14.867980+0900 SoccerScoreApp.iOS[53533:1013177] FFImageLoading log: Generating/retrieving image: B.gif
change_player_tutorial.gif Preloading finished! Key: B.gif
2022-12-20 09:02:23.464188+0900 SoccerScoreApp.iOS[53533:1013178] FFImageLoading log: Generating/retrieving image: C.gif
card_tutorial.gif Preloading finished! Key: C.gif

[ real device output] [真实设备输出]


022-12-19 08:25:35.176 SoccerScoreApp.iOS[1020:52406] FFImageLoading log: Image memory cache size: 591.97 MB
022-12-19 08:25:35.850 SoccerScoreApp.iOS[1020:52464] FFImageLoading log: Generating/retrieving image: A.gif

=================================================================
    Native Crash Reporting
=================================================================
Got a segv while executing native code. This usually indicates
a fatal error in the mono runtime or one of the native libraries 
used by your application.
=================================================================

=================================================================
    Native stacktrace:
=================================================================
    0x10755ea58 - /private/var/containers/Bundle/Application/E6BD92CA-CDBF-4B68-BE92-A90D6BC10226/SoccerScoreApp.iOS.app/SoccerScoreApp.iOS : GADInlineAdaptiveBannerAdSizeWithWidthAndMaxHeight
    0x107554ba4 - /private/var/containers/Bundle/Application/E6BD92CA-CDBF-4B68-BE92-A90D6BC10226/SoccerScoreApp.iOS.app/SoccerScoreApp.iOS : GADInlineAdaptiveBannerAdSizeWithWidthAndMaxHeight
    0x107562ed0 - /private/var/containers/Bundle/Application/E6BD92CA-CDBF-4B68-BE92-A90D6BC10226/SoccerScoreApp.iOS.app/SoccerScoreApp.iOS : mono_pmip
    0x249b95c10 - /usr/lib/system/libsystem_platform.dylib : <redacted>
    0x1da598340 - /System/Library/Frameworks/ImageIO.framework/ImageIO : <redacted>
    0x1da5a971c - /System/Library/Frameworks/ImageIO.framework/ImageIO : <redacted>
    0x1da5a969c - /System/Library/Frameworks/ImageIO.framework/ImageIO : <redacted>
    0x1da5a8f4c - /System/Library/Frameworks/ImageIO.framework/ImageIO : <redacted>
    0x1da3dc62c - /System/Library/Frameworks/ImageIO.framework/ImageIO : <redacted>
    0x1da3d800c - /System/Library/Frameworks/ImageIO.framework/ImageIO : <redacted>
    0x1da3e018c - /System/Library/Frameworks/ImageIO.framework/ImageIO : <redacted>
    0x1da7cc7d4 - /System/Library/Frameworks/CoreGraphics.framework/CoreGraphics : <redacted>
    0x1da7eebf4 - /System/Library/Frameworks/CoreGraphics.framework/CoreGraphics : <redacted>
    0x1da80e784 - /System/Library/Frameworks/CoreGraphics.framework/CoreGraphics : <redacted>
    0x1da7eebf4 - /System/Library/Frameworks/CoreGraphics.framework/CoreGraphics : <redacted>
    0x1da7c9550 - /System/Library/Frameworks/CoreGraphics.framework/CoreGraphics : CGAccessSessionCreate
    0x1da790264 - /System/Library/Frameworks/CoreGraphics.framework/CoreGraphics : <redacted>
    0x1da7dda5c - /System/Library/Frameworks/CoreGraphics.framework/CoreGraphics : <redacted>
    0x1da7abe9c - /System/Library/Frameworks/CoreGraphics.framework/CoreGraphics : <redacted>
    0x1da7cb9e0 - /System/Library/Frameworks/CoreGraphics.framework/CoreGraphics : <redacted>
    0x1da79d068 - /System/Library/Frameworks/CoreGraphics.framework/CoreGraphics : CGContextDrawImageWithOptions
    0x1da3f6d5c - /System/Library/Frameworks/ImageIO.framework/ImageIO : <redacted>
    0x1da3e4318 - /System/Library/Frameworks/ImageIO.framework/ImageIO : <redacted>
    0x1da3cf634 - /System/Library/Frameworks/ImageIO.framework/ImageIO : CGImageSourceCreateThumbnailAtIndex
    0x103e6aac8 - /private/var/containers/Bundle/Application/E6BD92CA-CDBF-4B68-BE92-A90D6BC10226/SoccerScoreApp.iOS.app/SoccerScoreApp.iOS : GADInlineAdaptiveBannerAdSizeWithWidthAndMaxHeight
    0x10326f330 - /private/var/containers/Bundle/Application/E6BD92CA-CDBF-4B68-BE92-A90D6BC10226/SoccerScoreApp.iOS.app/SoccerScoreApp.iOS : GADInlineAdaptiveBannerAdSizeWithWidthAndMaxHeight
    0x106102c2c - /private/var/containers/Bundle/Application/E6BD92CA-CDBF-4B68-BE92-A90D6BC10226/SoccerScoreApp.iOS.app/SoccerScoreApp.iOS : GADInlineAdaptiveBannerAdSizeWithWidthAndMaxHeight
    0x106116918 - /private/var/containers/Bundle/Application/E6BD92CA-CDBF-4B68-BE92-A90D6BC10226/SoccerScoreApp.iOS.app/SoccerScoreApp.iOS : GADInlineAdaptiveBannerAdSizeWithWidthAndMaxHeight
    0x1061775a4 - /private/var/containers/Bundle/Application/E6BD92CA-CDBF-4B68-BE92-A90D6BC10226/SoccerScoreApp.iOS.app/SoccerScoreApp.iOS : GADInlineAdaptiveBannerAdSizeWithWidthAndMaxHeight
    0x10610028c - /private/var/containers/Bundle/Application/E6BD92CA-CDBF-4B68-BE92-A90D6BC10226/SoccerScoreApp.iOS.app/SoccerScoreApp.iOS : GADInlineAdaptiveBannerAdSizeWithWidthAndMaxHeight
    0x106115030 - /private/var/containers/Bundle/Application/E6BD92CA-CDBF-4B68-BE92-A90D6BC10226/SoccerScoreApp.iOS.app/SoccerScoreApp.iOS : GADInlineAdaptiveBannerAdSizeWithWidthAndMaxHeight
    0x1061772b4 - /private/var/containers/Bundle/Application/E6BD92CA-CDBF-4B68-BE92-A90D6BC10226/SoccerScoreApp.iOS.app/SoccerScoreApp.iOS : GADInlineAdaptiveBannerAdSizeWithWidthAndMaxHeight
    0x1060fffbc - /private/var/containers/Bundle/Application/E6BD92CA-CDBF-4B68-BE92-A90D6BC10226/SoccerScoreApp.iOS.app/SoccerScoreApp.iOS : GADInlineAdaptiveBannerAdSizeWithWidthAndMaxHeight
    0x106214990 - /private/var/containers/Bundle/Application/E6BD92CA-CDBF-4B68-BE92-A90D6BC10226/SoccerScoreApp.iOS.app/SoccerScoreApp.iOS : GADInlineAdaptiveBannerAdSizeWithWidthAndMaxHeight
    0x1012d8480 - /private/var/containers/Bundle/Application/E6BD92CA-CDBF-4B68-BE92-A90D6BC10226/SoccerScoreApp.iOS.app/SoccerScoreApp.iOS : GADInlineAdaptiveBannerAdSizeWithWidthAndMaxHeight
    0x107566318 - /private/var/containers/Bundle/Application/E6BD92CA-CDBF-4B68-BE92-A90D6BC10226/SoccerScoreApp.iOS.app/SoccerScoreApp.iOS : mono_pmip
    0x107620ae4 - /private/var/containers/Bundle/Application/E6BD92CA-CDBF-4B68-BE92-A90D6BC10226/SoccerScoreApp.iOS.app/SoccerScoreApp.iOS : mono_pmip
    0x10754b0cc - /private/var/containers/Bundle/Application/E6BD92CA-CDBF-4B68-BE92-A90D6BC10226/SoccerScoreApp.iOS.app/SoccerScoreApp.iOS : GADInlineAdaptiveBannerAdSizeWithWidthAndMaxHeight
    0x1012dd610 - /private/var/containers/Bundle/Application/E6BD92CA-CDBF-4B68-BE92-A90D6BC10226/SoccerScoreApp.iOS.app/SoccerScoreApp.iOS : GADInlineAdaptiveBannerAdSizeWithWidthAndMaxHeight
    0x100fe2cf4 - /private/var/containers/Bundle/Application/E6BD92CA-CDBF-4B68-BE92-A90D6BC10226/SoccerScoreApp.iOS.app/SoccerScoreApp.iOS : GADInlineAdaptiveBannerAdSizeWithWidthAndMaxHeight
    0x1061d2910 - /private/var/containers/Bundle/Application/E6BD92CA-CDBF-4B68-BE92-A90D6BC10226/SoccerScoreApp.iOS.app/SoccerScoreApp.iOS : GADInlineAdaptiveBannerAdSizeWithWidthAndMaxHeight
    0x10621f8c4 - /private/var/containers/Bundle/Application/E6BD92CA-CDBF-4B68-BE92-A90D6BC10226/SoccerScoreApp.iOS.app/SoccerScoreApp.iOS : GADInlineAdaptiveBannerAdSizeWithWidthAndMaxHeight
    0x1012d8480 - /private/var/containers/Bundle/Application/E6BD92CA-CDBF-4B68-BE92-A90D6BC10226/SoccerScoreApp.iOS.app/SoccerScoreApp.iOS : GADInlineAdaptiveBannerAdSizeWithWidthAndMaxHeight
    0x107566318 - /private/var/containers/Bundle/Application/E6BD92CA-CDBF-4B68-BE92-A90D6BC10226/SoccerScoreApp.iOS.app/SoccerScoreApp.iOS : mono_pmip
    0x107620ae4 - /private/var/containers/Bundle/Application/E6BD92CA-CDBF-4B68-BE92-A90D6BC10226/SoccerScoreApp.iOS.app/SoccerScoreApp.iOS : mono_pmip
    0x10754b0cc - /private/var/containers/Bundle/Application/E6BD92CA-CDBF-4B68-BE92-A90D6BC10226/SoccerScoreApp.iOS.app/SoccerScoreApp.iOS : GADInlineAdaptiveBannerAdSizeWithWidthAndMaxHeight
    0x1012dd610 - /private/var/containers/Bundle/Application/E6BD92CA-CDBF-4B68-BE92-A90D6BC10226/SoccerScoreApp.iOS.app/SoccerScoreApp.iOS : GADInlineAdaptiveBannerAdSizeWithWidthAndMaxHeight
    0x100fe2934 - /private/var/containers/Bundle/Application/E6BD92CA-CDBF-4B68-BE92-A90D6BC10226/SoccerScoreApp.iOS.app/SoccerScoreApp.iOS : GADInlineAdaptiveBannerAdSizeWithWidthAndMaxHeight
    0x1061d35f8 - /private/var/containers/Bundle/Application/E6BD92CA-CDBF-4B68-BE92-A90D6BC10226/SoccerScoreApp.iOS.app/SoccerScoreApp.iOS : GADInlineAdaptiveBannerAdSizeWithWidthAndMaxHeight
    0x1062271e4 - /private/var/containers/Bundle/Application/E6BD92CA-CDBF-4B68-BE92-A90D6BC10226/SoccerScoreApp.iOS.app/SoccerScoreApp.iOS : GADInlineAdaptiveBannerAdSizeWithWidthAndMaxHeight
    0x1062e3f94 - /private/var/containers/Bundle/Application/E6BD92CA-CDBF-4B68-BE92-A90D6BC10226/SoccerScoreApp.iOS.app/SoccerScoreApp.iOS : GADInlineAdaptiveBannerAdSizeWithWidthAndMaxHeight
    0x1061dde58 - /private/var/containers/Bundle/Application/E6BD92CA-CDBF-4B68-BE92-A90D6BC10226/SoccerScoreApp.iOS.app/SoccerScoreApp.iOS : GADInlineAdaptiveBannerAdSizeWithWidthAndMaxHeight
    0x10623ab90 - /private/var/containers/Bundle/Application/E6BD92CA-CDBF-4B68-BE92-A90D6BC10226/SoccerScoreApp.iOS.app/SoccerScoreApp.iOS : GADInlineAdaptiveBannerAdSizeWithWidthAndMaxHeight
    0x1062ed5ec - /private/var/containers/Bundle/Application/E6BD92CA-CDBF-4B68-BE92-A90D6BC10226/SoccerScoreApp.iOS.app/SoccerScoreApp.iOS : GADInlineAdaptiveBannerAdSizeWithWidthAndMaxHeight
    0x106224a5c - /private/var/containers/Bundle/Application/E6BD92CA-CDBF-4B68-BE92-A90D6BC10226/SoccerScoreApp.iOS.app/SoccerScoreApp.iOS : GADInlineAdaptiveBannerAdSizeWithWidthAndMaxHeight
    0x100bd2ab8 - /private/var/containers/Bundle/Application/E6BD92CA-CDBF-4B68-BE92-A90D6BC10226/SoccerScoreApp.iOS.app/SoccerScoreApp.iOS : GADInlineAdaptiveBannerAdSizeWithWidthAndMaxHeight
    0x100bdeaf4 - /private/var/containers/Bundle/Application/E6BD92CA-CDBF-4B68-BE92-A90D6BC10226/SoccerScoreApp.iOS.app/SoccerScoreApp.iOS : GADInlineAdaptiveBannerAdSizeWithWidthAndMaxHeight
    0x100bded68 - /private/var/containers/Bundle/Application/E6BD92CA-CDBF-4B68-BE92-A90D6BC10226/SoccerScoreApp.iOS.app/SoccerScoreApp.iOS : GADInlineAdaptiveBannerAdSizeWithWidthAndMaxHeight
    0x100ba75ec - /private/var/containers/Bundle/Application/E6BD92CA-CDBF-4B68-BE92-A90D6BC10226/SoccerScoreApp.iOS.app/SoccerScoreApp.iOS : GADInlineAdaptiveBannerAdSizeWithWidthAndMaxHeight
    0x100ba73ec - /private/var/containers/Bundle/Application/E6BD92CA-CDBF-4B68-BE92-A90D6BC10226/SoccerScoreApp.iOS.app/SoccerScoreApp.iOS : GADInlineAdaptiveBannerAdSizeWithWidthAndMaxHeight
    0x100be5048 - /private/var/containers/Bundle/Application/E6BD92CA-CDBF-4B68-BE92-A90D6BC10226/SoccerScoreApp.iOS.app/SoccerScoreApp.iOS : GADInlineAdaptiveBannerAdSizeWithWidthAndMaxHeight
    0x100bdec80 - /private/var/containers/Bundle/Application/E6BD92CA-CDBF-4B68-BE92-A90D6BC10226/SoccerScoreApp.iOS.app/SoccerScoreApp.iOS : GADInlineAdaptiveBannerAdSizeWithWidthAndMaxHeight
    0x100bdeb58 - /private/var/containers/Bundle/Application/E6BD92CA-CDBF-4B68-BE92-A90D6BC10226/SoccerScoreApp.iOS.app/SoccerScoreApp.iOS : GADInlineAdaptiveBannerAdSizeWithWidthAndMaxHeight
    0x100bb1348 - /private/var/containers/Bundle/Application/E6BD92CA-CDBF-4B68-BE92-A90D6BC10226/SoccerScoreApp.iOS.app/SoccerScoreApp.iOS : GADInlineAdaptiveBannerAdSizeWithWidthAndMaxHeight
    0x103a2fd70 - /private/var/containers/Bundle/Application/E6BD92CA-CDBF-4B68-BE92-A90D6BC10226/SoccerScoreApp.iOS.app/SoccerScoreApp.iOS : GADInlineAdaptiveBannerAdSizeWithWidthAndMaxHeight
    0x100bb3408 - /private/var/containers/Bundle/Application/E6BD92CA-CDBF-4B68-BE92-A90D6BC10226/SoccerScoreApp.iOS.app/SoccerScoreApp.iOS : GADInlineAdaptiveBannerAdSizeWithWidthAndMaxHeight
    0x1012d8480 - /private/var/containers/Bundle/Application/E6BD92CA-CDBF-4B68-BE92-A90D6BC10226/SoccerScoreApp.iOS.app/SoccerScoreApp.iOS : GADInlineAdaptiveBannerAdSizeWithWidthAndMaxHeight
    0x107566318 - /private/var/containers/Bundle/Application/E6BD92CA-CDBF-4B68-BE92-A90D6BC10226/SoccerScoreApp.iOS.app/SoccerScoreApp.iOS : mono_pmip
    0x1076223d0 - /private/var/containers/Bundle/Application/E6BD92CA-CDBF-4B68-BE92-A90D6BC10226/SoccerScoreApp.iOS.app/SoccerScoreApp.iOS : mono_pmip
    0x107665634 - /private/var/containers/Bundle/Application/E6BD92CA-CDBF-4B68-BE92-A90D6BC10226/SoccerScoreApp.iOS.app/SoccerScoreApp.iOS : mono_pmip
    0x107662ea8 - /private/var/containers/Bundle/Application/E6BD92CA-CDBF-4B68-BE92-A90D6BC10226/SoccerScoreApp.iOS.app/SoccerScoreApp.iOS : mono_pmip
    0x10766e63c - /private/var/containers/Bundle/Application/E6BD92CA-CDBF-4B68-BE92-A90D6BC10226/SoccerScoreApp.iOS.app/SoccerScoreApp.iOS : mono_pmip
    0x10766e4c0 - /private/var/containers/Bundle/Application/E6BD92CA-CDBF-4B68-BE92-A90D6BC10226/SoccerScoreApp.iOS.app/SoccerScoreApp.iOS : mono_pmip
    0x249b9d9ac - /usr/lib/system/libsystem_pthread.dylib : _pthread_start
    0x249b9ce68 - /usr/lib/system/libsystem_pthread.dylib : thread_start

=================================================================
    Basic Fault Address Reporting
=================================================================
Memory around native instruction pointer (0x249b94a9c):0x249b94a8c  21 00 05 8b 20 04 40 ac 21 80 00 91 42 00 05 cb  !... .@.!...B...
0x249b94a9c  02 0c 00 ac 42 00 01 f1 e9 00 00 54 60 04 00 ac  ....B......T`...
0x249b94aac  63 80 00 91 20 04 40 ac 21 80 00 91 42 80 00 f1  c... .@.!...B...
0x249b94abc  68 ff ff 54 21 00 02 8b 22 0c 40 ac 60 04 00 ac  h..T!...".@.`...

=================================================================
    Managed Stacktrace:
=================================================================
      at <unknown> <0xffffffff>
      at ImageIO.CGImageSource:CGImageSourceCreateThumbnailAtIndex <0x00007>
      at ImageIO.CGImageSource:CreateThumbnail <0x0006f>
      at FFImageLoading.Decoders.GifDecoder:GetFrames <0x0012b>
      at <SourceRegfToDecodedImageAsync>d__2:MoveNext <0x01407>
      at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1:Start <0x00173>
      at FFImageLoading.Decoders.GifDecoder:SourceRegfToDecodedImageAsync <0x0026b>
      at <DecodeAsync>d__1:MoveNext <0x0055f>
      at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1:Start <0x00173>
      at FFImageLoading.Decoders.GifDecoder:DecodeAsync <0x0024b>
      at <GenerateImageAsync>d__104:MoveNext <0x0030f>
      at System.Object:runtime_invoke_dynamic <0x0010f>
      at <unknown> <0xffffffff>
      at System.Object:__icall_wrapper_mono_gsharedvt_constrained_call <0x00007>
      at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1:Start <0x00173>
      at FFImageLoading.Work.ImageLoaderTask`3:GenerateImageAsync <0x002cf>
      at <RunAsync>d__109:MoveNext <0x01ed3>
      at System.Object:runtime_invoke_dynamic <0x0010f>
      at <unknown> <0xffffffff>
      at System.Object:__icall_wrapper_mono_gsharedvt_constrained_call <0x00007>
      at System.Runtime.CompilerServices.AsyncTaskMethodBuilder:Start <0x00173>
      at FFImageLoading.Work.ImageLoaderTask`3:RunAsync <0x00187>
      at <RunImageLoadingTaskAsync>d__49:MoveNext <0x00993>
      at System.Runtime.CompilerServices.AsyncTaskMethodBuilder:Start <0x00173>
      at FFImageLoading.Work.WorkScheduler:RunImageLoadingTaskAsync <0x001a7>
      at <<TakeFromPendingTasksAndRunAsync>b__3>d:MoveNext <0x000ff>
      at System.Runtime.CompilerServices.AsyncTaskMethodBuilder:Start <0x0019b>
      at <>c__DisplayClass48_0:<TakeFromPendingTasksAndRunAsync>b__3 <0x0016b>
      at System.Threading.Tasks.Task`1:InnerInvoke <0x00057>
      at System.Threading.Tasks.Task:Execute <0x00023>
      at System.Threading.Tasks.Task:ExecutionContextCallback <0x00057>
      at System.Threading.ExecutionContext:RunInternal <0x001ab>
      at System.Threading.ExecutionContext:Run <0x0002b>
      at System.Threading.Tasks.Task:ExecuteWithThreadLocal <0x00127>
      at System.Threading.Tasks.Task:ExecuteEntry <0x0010f>
      at System.Threading.Tasks.Task:System.Threading.IThreadPoolWorkItem.ExecuteWorkItem <0x00017>
      at System.Threading.ThreadPoolWorkQueue:Dispatch <0x001e7>
      at ObjCRuntime.Runtime:ThreadPoolDispatcher <0x0003f>
      at System.Threading._ThreadPoolWaitCallback:PerformWaitCallback <0x00087>
      at System.Object:runtime_invoke_dynamic <0x0010f>
=================================================================

[My FinishedLaunching method] [我的 FinishedLaunching 方法]


public override bool FinishedLaunching(UIApplication app, NSDictionary options)
{

    global::Xamarin.Forms.Forms.Init();

    CachedImageRenderer.Init();
    CachedImageRenderer.InitImageSourceHandler();
    var config = new FFImageLoading.Config.Configuration()
    {
        VerboseLogging = true,
        VerbosePerformanceLogging = true,
        VerboseMemoryCacheLogging = true,
        VerboseLoadingCancelledLogging = true,
        Logger = new CustomLogger(),
        MaxMemoryCacheSize = 20000000
    };
    ImageService.Instance.Initialize(config);

[CustomLogger] [自定义记录器]

public class CustomLogger : FFImageLoading.Helpers.IMiniLogger
{
    public void Debug(string message)
    {
        Console.WriteLine($"FFImageLoading log: {message}");
    }

    public void Error(string errorMessage)
    {
        Console.WriteLine($"FFImageLoading error log: {errorMessage}");
    }

    public void Error(string errorMessage, Exception ex)
    {
        Error(errorMessage + System.Environment.NewLine + ex.ToString());
    }
}

How can i fix this?我怎样才能解决这个问题?

My Environment我的环境

  • Xamarin.Forms: 5.0.0.2478 Xamarin.Forms:5.0.0.2478
  • Xamarin.FFImageLoading: 2.4.11.982 Xamarin.FFImageLoading:2.4.11.982
  • Xamarin.FFImageLoading.Forms: 2.4.11.982 Xamarin.FFImageLoading.Forms:2.4.11.982
  • MarcTron.Admob: 1.9.0.3 MarcTron.Admob:1.9.0.3

Success Simulators成功模拟器

  • iPhone SE(2nd generation) iOS 16.1 iPhone SE(第 2 代)iOS 16.1
  • iPhone SE(3rd generation) iOS 16.1 iPhone SE(第 3 代)iOS 16.1
  • iPhone 14 iOS 16.1 iPhone 14 iOS 16.1

My Real Device我的真实设备

  • iPhone SE(2nd generation) iOS 16.2(15.x) iPhone SE(第二代) iOS 16.2(15.x)
  • What is original width and height of gif.A? gif.A 的原始宽度和高度是多少?
  • How many frames?多少帧?
  • In memory each pixel takes 4 bytes.在内存中每个像素占用 4 个字节。 Multiply "4 * original width * height * #frames".乘以“4 * 原始宽度 * 高度 * #frames”。
  • What value do you get?你得到什么价值? That's what will be needed in cache size to "load the gif".这就是“加载 gif”所需的缓存大小。 Note that it doesn't matter how small the file is on disk;请注意,文件在磁盘上的大小无关紧要; that is "compressed" size.即“压缩”大小。 In memory, it is not compressed.在内存中,它没有被压缩。 It also doesn't matter how small you are downsampling to;下采样到多小也无关紧要; it first loads at the original size [I think].它首先以原始大小加载 [我认为]。

To fix, do EITHER:要修复,请执行以下任一操作:

var config = new FFImageLoading.Config.Configuration()
{
    MaxMemoryCacheSize = 9999999, // Try different values here. Bigger uses more app memory.
};
ImageService.Instance.Initialize(config);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM