0

I'm starting with xcode and swift now. I have tu use xcode 12 and I'm trying to add a lottie animation but I always have the same error.

I've create a short function with I call on viewDidLoad

This is my Outet:

@IBOutlet weak var animationView: LottieAnimationView!

And my function

override func viewDidLoad() {
    super.viewDidLoad()
    comenzarAnimacion()

}

func comenzarAnimacion(){
    animationView.animation = LottieAnimation.named("68802-arrow-down-purple")
    animationView.contentMode = .scaleToFill
    animationView.loopMode = .loop
    animationView.play()
}

The console shows the next error:

2022-12-06 04:52:22.824975-0800 eventos[1572:28620] [Storyboard] Unknown class _TtC6Lottie13AnimationView in Interface Builder file.

I've tryed several difrent lottie json but the same error. any advice?

Monrac
  • 49
  • 1
  • 6
  • Which line exactly causes the crash? Is there any error message in console when it crashes? Like force unwrap issue? – Larme Dec 06 '22 at 12:36
  • The crash is always with animationView.animation = LottieAnimation.named("68802-arrow-down-purple") the error is animationView.animation = LottieAnimation.named("68802-arrow-down-purple") and there is this message in console: 2022-12-06 04:52:22.824975-0800 eventos[1572:28620] [Storyboard] Unknown class _TtC6Lottie13AnimationView in Interface Builder file. – Monrac Dec 06 '22 at 12:54
  • Check/uncheck https://stackoverflow.com/a/55358396/1801544 for the IBOutlet since the class seems not found for `LottieAnimationView`. You can also clean your project (Cmd+Maj+K). – Larme Dec 06 '22 at 13:07
  • I''ve trying cleaning but same mistake – Monrac Dec 06 '22 at 13:34

1 Answers1

0

"EXC_BAD_ACCESS" error message (code=1, address=0x0) is typically seen when your app is trying to access memory that it is not allowed to access.

But in your case, Class is not recognized by Interface Builder. To fix this error, you will need to ensure that the Lottie framework is properly included, linked, and imported in your project. Once this is done, Interface Builder should be able to recognize the Lottie AnimationView class and you will be able to use it in your Interface Builder file.

Joyal Clifford
  • 1,212
  • 11
  • 20
  • Ok I see what you mean but I don't have idea how to check ottie framework is properly included, linked, and imported in your project I just add using https://github.com/airbnb/lottie-ios.git – Monrac Dec 06 '22 at 13:35
  • 1
    It was a problem with cocoapods so you were right thanks! – Monrac Dec 08 '22 at 12:28