airbnb / lottie-ios

An iOS library to natively render After Effects vector animations
http://airbnb.io/lottie/
Apache License 2.0
25.7k stars 3.74k forks source link

How to tell if a CompatibleAnimationView had loading errors? #2445

Closed Lancelotbronner closed 2 months ago

Lancelotbronner commented 2 months ago

Which Version of Lottie are you using?

Lottie 4.4.3

Expected Behavior

I'd like something like compatibleAnimationView.loadingError or at least compatibleAnimationView.isAnimationLoaded to check for failures.

Actual Behavior

I'm initializing CompatibleAnimationView as follows:

NSData *data = [[NSData alloc] initWithContentsOfURL:url];
animationView = [[CompatibleAnimationView alloc] initWithData:data compatibleRenderingEngineOption:renderingEngine];

I need to check whether the animation successfully loaded or not to plug into our existing (legacy) resource management system. This is an Objective-C++ SwiftPM package which means we can't directly use AnimationView or LottieAnimation.

Quickly looking at the source code there doesn't seem to be any way to tell if there was an error loading the animation or what the error was.

Animation JSON

Currently all our animations fail to load only when using CompatibleAnimationView. I get no logs or feedback from the failures. Loading the same Data using AnimationView works without any issues.