Closed
Description
When I compiled and ran with the latest version of Xcode 11.4, there was a crash anywhere I used Lottie on iOS 9 devices
Check these before submitting:
- [✔️] The issue doesn't involve an Unsupported Feature
- [✔️] This issue isn't related to another open issue
This issue is a:
- [] Non-Crashing Bug (Visual or otherwise)
- [✔️] Crashing Bug
- [] Feature Request
- [] Regression (Something that once worked, but doesn't work anymore)
Which Version of Lottie are you using?
Lottie 3.1.6
What Platform are you on?
- [] MacOS
- [✔️] iOS
What Language are you in?
- [✔️] Swift
- [] Objective-C
Activity
robaggio commentedon Mar 30, 2020
Same for me, only iOS 9 devices will crash, the same code on Xcode 11.3 is OK.
robaggio commentedon Mar 30, 2020
The example project in the repo can reproduce the crash, with Xcode 11.4 on an iOS 9 device. Change the deployment target to 9.0 first.
frank-du commentedon Apr 1, 2020
Same for me
hakonk commentedon Apr 1, 2020
Can confirm this problem on iOS 9 with Xcode 11.4 as well. Enabling Zombie Objects in Xcode 11.4 results in the following output before crashing the application:
*** -[Lottie.AnimationContainer release]: message sent to deallocated instance 0x<address>
brunsman commentedon Apr 1, 2020
Same problem here. I blame the changed embedding of frameworks in Xcode 11.4. Downgraded to Xcode 11.3 for now and waiting for Apple to fix the embedding of frameworks.
hakonk commentedon Apr 2, 2020
@brunsman Do you have more details on what the change in embedding of frameworks entails?
brunsman commentedon Apr 15, 2020
After digging into the issue more, I can now isolate the issue to something else. Will post the same here for reference, see https://forums.developer.apple.com/thread/131551
The code seems related to Xcode 11.4, ios 9 devices, and custom CALayers with properties.
To see this problem, Create an extension of an CALayer:
Now programmatically create such a layer, e.g. in a viewDidLoad
let customLayer = CustomLayer()
Compile and run this on a iOS 9 device (my tests were with an iPhone 4S with iOS 9.3.6). The device crashes when initializing the layer. It is deallocated BEFORE it can actually set the property on the customLayer. Enable zombies for a more detailed stack trace.
Since lottie uses custom CALayers with properties, it now crashes on iOS 9 devices when using Xcode 11.4. Hoping for a fix or workaround from Apple. Filed a bug report about it.
hakonk commentedon Apr 15, 2020
Great work @brunsman ! Looking forward to hearing the about the response.
hakonk commentedon Apr 15, 2020
@brunsman I tried to circumvent the initializer of
CALayer
in Swift by making a simple category forCALayer
in Objective-C:CALayer+Init.h
CALayer+Init.m
Making use of the class method in this category seems to work.
Edit:
Unfortunately, trying to access the property on
CustomLayer
after making use of the class method in the category mentioned above, I get a runtime error: "Thread 1: EXC_BAD_ACCESS (code=2, address=0x.......)"Interestingly, changing the property to be a
let
instead ofvar
, does not lead to a crash. I.e.:brunsman commentedon Apr 15, 2020
@hakonk If you find a workaround, that would be great! So far, no dice.
Edit: XCode 11.4.1 also does not fix this issue. Still waiting for a response from Apple.
hakonk commentedon Apr 16, 2020
@brunsman The approach above with the Objective-C category is flawed for sure. My colleagues have pointed me in the direction of reading up on
CALayer
and the magic that happens under the hood, so I'll do that when I have time.I attempted to make use of Objective-C's runtime capabilities (associated objects) to implement a property on a subclass of
CALayer
:While it works, it's a cumbersome and somewhat hacky approach for just implementing a simple property.
brunsman commentedon May 7, 2020
Reported the bug to apple on the 15th of april. Got an update from Apple:
Hoping for this best and that the new xCode will fix the problem...
falcon283 commentedon May 18, 2020
XCode 11.5 GM is out and the release notes state:
Is it the bug we are hunting?
Anyone have chance to test it?
Many thanks
hakonk commentedon May 19, 2020
@falcon283 @brunsman
I tried compiling and running with Xcode Version 11.5 (11E608c) and I'm still getting
-[Lottie.AnimationContainer release]: message sent to deallocated instance
(Zombie objects enabled).falcon283 commentedon May 19, 2020
Thanks a lot for the feedback @hakonk
10 remaining items
hakonk commentedon Oct 6, 2020
Wow, that's a bummer, @brunsman! Anyway, it's interesting to know that the issue is still open.
zhiliang729 commentedon Oct 20, 2020
xcode 12.0.1 still crash !!!!!!!!!!
sonnt612 commentedon Oct 30, 2020
How to fix this?
sonnt612 commentedon Oct 30, 2020
xcode 12.1 still crash
robaggio commentedon Oct 30, 2020
Maybe it is time to consider dropping support for iOS9 in your app.
Mervin1024 commentedon Nov 25, 2020
same to me. xcode 12.0
chengyang1380 commentedon Feb 9, 2021
Xcode 12.3 still crash. 😥
FunnyerFeng commentedon Feb 26, 2021
Version 12.4 (12D4e)
xperiatrix commentedon Feb 27, 2021
I switched to a gif animation in Kingfisher's AnimatedImageView only on iOS9 instead of lottie's way .
brunsman commentedon May 20, 2021
From Apple:
I haven't tested whether this works since we stopped using iOS 9. Perhaps it can be used by others.
yaochenfeng commentedon Jul 30, 2021
也许用OC实现CALayer的子类,Swift中使用,iOS10以上就不用这样了
Viveco commentedon Jan 26, 2022
use xib crah, need code xcode 12.3 ios9 lottie 3.2.1
Feng999 commentedon Feb 28, 2022
anything new?
Xcode 13.2.1, the problem is still there
calda commentedon Jul 13, 2022
Closing since Lottie no longer supports iOS 9 (the minimum deployment version is now iOS 11)