Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lottie Swift with Xcode 11.2 Crashes when creating AnimationView #1066

Closed
4 tasks done
gabors opened this issue Oct 31, 2019 · 41 comments
Closed
4 tasks done

Lottie Swift with Xcode 11.2 Crashes when creating AnimationView #1066

gabors opened this issue Oct 31, 2019 · 41 comments

Comments

@gabors
Copy link
Contributor

gabors commented Oct 31, 2019

@thedrick

  • 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.3 release, nut current master branch also crashes
Using Lottie as a SwiftPM package

What Platform are you on?

  • [] MacOS
  • iOS

What Language are you in?

  • Swift
  • [] Objective-C

Expected Behavior

Actual Behavior

Screen Shot 2019-10-31 at 16 19 04

Code Example

let x = AnimationView(name: "test")

Animation JSON

Any JSON animation from your example project

@danielsaidi
Copy link

I just noticed this as well.

@mborsten
Copy link

mborsten commented Nov 1, 2019

I get this crash too with Xcode 11.2. It happens when setting an animation on the animation view, not when creating the animation view.

@makoni
Copy link

makoni commented Nov 1, 2019

Same for me. That happened with Xcode 11.2 beta too

@mborsten
Copy link

mborsten commented Nov 1, 2019

This crash does not seem related to 13.2. It happens on simulator and devices running 13.2 and 12.4.2.

@danielsaidi
Copy link

It's a compiler issue, right? I can run our prod app with the latest Lottie version when it's built with the 5.1 compiler, but not with the latest compiler.

@gabors
Copy link
Contributor Author

gabors commented Nov 1, 2019

It's a compiler issue, right? I can run our prod app with the latest Lottie version when it's built with the 5.1 compiler, but not with the latest compiler.

Well yeah, if you build with Xcode 11.1 or earlier you're fine.
Issue is using Xcode 11.2 which you need if you want to debug on iOS 13.2.

@thedrick
Copy link
Contributor

thedrick commented Nov 1, 2019

Could someone set up a sample project or link me to an animation that is causing this crash? I can't reproduce this on my end.

@rouviere
Copy link

rouviere commented Nov 1, 2019

I am having the same problem. Anything Lottie on Xcode 11.2 will not run. Here is a link to a repository: https://github.com/rouviere/lottie

It does not run on the simulator or on an iPhone running 13.2. I had to go back to Xcode 11.1 where it runs fine on the simulator but will not run on an iPhone running 13.2.

@thedrick
Copy link
Contributor

thedrick commented Nov 1, 2019

I just verified this seems to only happen when you include Lottie through SPM. Does this also happen with CocoaPods? I tested the same code with including Lottie files manually vs. using SPM to download the package and it only crashes when using SPM

@gabors
Copy link
Contributor Author

gabors commented Nov 1, 2019

I just verified this seems to only happen when you include Lottie through SPM. Does this also happen with CocoaPods? I tested the same code with including Lottie files manually vs. using SPM to download the package and it only crashes when using SPM

I only tried with swift pm.

@danielsaidi
Copy link

We also use SPM. I can go back to CocoaPods and see if it solves the problem.

@mborsten
Copy link

mborsten commented Nov 2, 2019

I’m using SPM and it crashes. I’ve just tried this with Cocoapods and then it doesn’t crash.

@ydnar
Copy link

ydnar commented Nov 2, 2019

The issue is related to stripped generic symbols from a SPM package.

Try disabling dead code stripping on your app’s project: DEAD_CODE_STRIPPING = NO

https://bugs.swift.org/plugins/servlet/mobile#issue/SR-11564

@makoni
Copy link

makoni commented Nov 4, 2019

Adding with Carthage also works. Lottie doesn't crash

@buba447
Copy link
Collaborator

buba447 commented Nov 4, 2019

Hey everyone! Im looking into this issue and working to see if it can be fixed code side. For now use the solution provided by @ydnar above.

@buba447
Copy link
Collaborator

buba447 commented Nov 4, 2019

An update, theres a swift bug filed here for the same issue on another repo. Please add your comments there so we can get a quick fix from apple!

@danielsaidi
Copy link

I can confirm that disabling dead code stripping works. However, I don’t know if this causes any side-effects.

@abrahamNefi
Copy link

i have disable dead code stripping code and still crashing in this line when try to load xib files with lottie Animated View:
let animationLayer = AnimationContainer(animation: animation, imageProvider: imageProvider, textProvider: textProvider)
and in console log: [Storyboard] Unknown class AnimationView in Interface Builder file.

@danielsaidi
Copy link

If you press enter in the textfield where the storyboard refers AnimationView, does it resolve to being defined in Lottie?

@rouviere
Copy link

rouviere commented Nov 5, 2019

Confirmed that yndar's solution works.

@zackdotcomputer
Copy link

Was this related to the 11.2 issue that lead to Apple pulling that version? If so, it should fixed as of 11.2.1. Can someone who was running into this issue confirm whether it's still happening in 11.2.1?

@danielsaidi
Copy link

danielsaidi commented Nov 14, 2019

Sadly, you still need to disable dead code stripping in 11.2.1.

@shial4
Copy link

shial4 commented Nov 17, 2019

11.2.1 still encountering this crash

@asowers1
Copy link
Contributor

Switching from SPM back to Cocoapods worked for me.

@danielsaidi
Copy link

Yes, CocoaPods doesn't have this problem. @gabors Do you think it would be good to clarify in the title that it only happens with SPM?

@gabors
Copy link
Contributor Author

gabors commented Nov 28, 2019

Yes, CocoaPods doesn't have this problem. @gabors Do you think it would be good to clarify in the title that it only happens with SPM?

Yes sir this issue started when I switched from using Carthage to SwiftPM

@duraz
Copy link

duraz commented Dec 1, 2019

SwiftPM for me is the issue. Using Lottie from Carthage worked. Now though the animation is not nil loaded from json, setting the animation crashes the app.

@bozidarsevo
Copy link

I just tried it with Xcode 11.3 and using Lottie 3.1.5 with SPM and it works ok now with DEAD_CODE_STRIPPING = YES. Also this link https://bugs.swift.org/plugins/servlet/mobile#issue/SR-11564 was mentioned above and there somebody mentioned that it is fixed.

@vladyslavsosiuk
Copy link

I tried to add AnimationView in xib file and I got crash.
Once I created AnimationView in code crash gone

@dvlpjrs
Copy link

dvlpjrs commented Apr 5, 2020

I am getting the error at
let animationLayer = AnimationContainer(animation: animation, imageProvider: imageProvider, textProvider: textProvider)
[Storyboard] Unknown class _TtC4_VPN13AnimationView in Interface Builder file.
Installed using cocoapods and running on Xcode 11.4

@vladyslavsosiuk
Copy link

I am getting the error at

let animationLayer = AnimationContainer(animation: animation, imageProvider: imageProvider, textProvider: textProvider)

[Storyboard] Unknown class _TtC4_VPN13AnimationView in Interface Builder file.

Installed using cocoapods and running on Xcode 11.4

Try to create it from code

@iamsanketray123
Copy link

My app was crashing when I added a view from a XIB. It was fixed when I added it via code.

@AyushKovind2
Copy link

I just verified this seems to only happen when you include Lottie through SPM. Does this also happen with CocoaPods? I tested the same code with including Lottie files manually vs. using SPM to download the package and it only crashes when using SPM

Yes it is also happening with Cocoapods. Whenever I am using lottieanimation in my view, it crashes

@shimon-azulay-healthy
Copy link

@iamsanketray123 @vladislavsosiuk

Can you give more details about the crash from XIB.
I can't recreate it (Xcode 12.2 & Lottie 3.1.5).

Thanks.

@vladyslavsosiuk
Copy link

@iamsanketray123 @vladislavsosiuk

Can you give more details about the crash from XIB.
I can't recreate it (Xcode 12.2 & Lottie 3.1.5).

Thanks.

@shimazu2 simply use AnimationView in xib and app will crash in runtime while awaking xib or trying to animate it, i don't remember for sure as it was long time ago

@shimon-azulay-healthy
Copy link

@iamsanketray123 @vladislavsosiuk
Can you give more details about the crash from XIB.
I can't recreate it (Xcode 12.2 & Lottie 3.1.5).
Thanks.

@shimazu2 simply use AnimationView in xib and app will crash in runtime while awaking xib or trying to animate it, i don't remember for sure as it was long time ago

@vladislavsosiuk Well... thats exactly what I have tried.. no crash.

@vladyslavsosiuk
Copy link

@shimazu2 the only thing i can to tell is that i used lottie 3.1.6

@Saurabh-vegans
Copy link

I tried to add AnimationView in xib file and I got crash.
Once I created AnimationView in code crash gone

I'm also having the same issue then I noticed that I have to select Lottie in modules

@Viveco
Copy link

Viveco commented Jan 26, 2022

use xib crash, need code

@calda
Copy link
Member

calda commented Jul 13, 2022

Closing since this seems like a potentially outdated issue. Feel free to re-open if you're still experiencing this issue.

@calda calda closed this as completed Jul 13, 2022
@deremakif
Copy link

I have a similar issue. I used LottieAnimationView. My app crashes on iPhone 6 with iOS 12 which is a real device.

When I try it on a simulator with the same config, iPhone 6 with iOS 12, it works as expected. My Podfile:

pod 'lottie-ios', '~> 4.0.1', :modular_headers => true

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests