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

[iOS] App is crashing if you use CompatibleAnimationView in xib/storyboard #2161

Closed
Saratsin opened this issue Aug 28, 2023 · 6 comments
Closed

Comments

@Saratsin
Copy link
Contributor

Which Version of Lottie are you using?

Lottie 4.2.0 - iOS

Steps to reproduce

  1. Create a simple Xcode project with storyboard UI and Objective-C as a language
  2. Add Lottie reference in any way (e.g. as xcframework reference)
  3. Add UIView element the main xib file or storyboard, change its type to CompatibleAnimationView
  4. Build and run project on simulator or device

Expected Behavior

App is launching and shows the main screen without a problems

Actual Behavior

App is launching and crashes on the main screen:

Lottie/CompatibleAnimationView.swift:197: Fatal error: init(coder:) has not been implemented
2023-08-28 19:06:27.015025+0300 LottieTest[84664:923278] Lottie/CompatibleAnimationView.swift:197: Fatal error: init(coder:) has not been implemented

Reason:

Actually it is described in the exception message. CompatibleAnimationView doesn't implement required init method

@calda
Copy link
Member

calda commented Aug 28, 2023

@Saratsin, are you interested in making a PR to fix this? That would be much appreciated!

Perhaps this init needs to be made public? https://github.com/airbnb/lottie-ios/blob/master/Sources/Public/iOS/Compatibility/CompatibleAnimationView.swift#L196C1-L198C4

If not, could you share a sample Xcode project that demonstrates the error?

@Saratsin
Copy link
Contributor Author

@Saratsin, are you interested in making a PR to fix this? That would be much appreciated!

Perhaps this init needs to be made public? https://github.com/airbnb/lottie-ios/blob/master/Sources/Public/iOS/Compatibility/CompatibleAnimationView.swift#L196C1-L198C4

If not, could you share a sample Xcode project that demonstrates the error?

Sure, I can create a PR with fix for it. Do I have to update version to 4.2.1 in podsec and package.json files, or just add the fix?

@calda
Copy link
Member

calda commented Aug 28, 2023

If you share a sample xcode project to demonstrate the error you can just point to 4.2.0. If you want to fix the error and then validate that the sample project now works correctly you'd need to edit the code locally, in the cocoapod checkouts.

@calda
Copy link
Member

calda commented Sep 8, 2023

@Saratsin, are you able to share a sample project that demonstrates this issue?

@Saratsin
Copy link
Contributor Author

@calda sorry for the delay, here's a sample project with the reproduction of this issue: Lottie-Issue-2161. You just need to build the solution, and you will receive this error in output:
Screenshot 2023-09-15 at 22 17 16

@Saratsin
Copy link
Contributor Author

Saratsin commented Sep 15, 2023

@calda Here's the Pull Request with fix.
Let me know if there's need in some other changes, e.g. version updates or something else
#2192

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

2 participants