Lottie-ios: Module compiled with Swift 5.1 cannot be imported by the Swift 5.1.2 compiler

Created on 19 Nov 2019  路  12Comments  路  Source: airbnb/lottie-ios

This issue is a:

  • [] Crashing Bug

Which Version of Lottie are you using?

lottie-ios 3.1.5, lottie-react-native 3.3.2

What Platform are you on?

  • [] MacOS
  • [] iOS
  • Xcode Version 11.2.1 (11B500)

What Language are you in?

  • [] Swift
  • React Native

Actual Behavior

Module compiled with Swift 5.1 cannot be imported by the Swift 5.1.2 compiler when building. Have removed Pods/ and installed again, tried different toolchains.

Unable to run project does anyone know how to fix this?

Thanks!

Most helpful comment

Im facing the same issue after the update!

All 12 comments

Im facing the same issue after the update!

Same here - I can run my project on my laptop in Xcode 11.1, but on my desktop in Xcode 11.2.1 it's "Module compiled with Swift 5.1 cannot be imported by the Swift 5.1.2 compiler"

Try recompiling your module, either pod update or carthage update should solve this issue. Had the same problem when I upgraded to XCode 11

just calling carthage update on the existing project did not work for me, but I deleted the framework entirely from the project and then ran carthage update and then re-added the framework to the project and that got things working.

@coreyd303 Have tried pod update and to remove Pods/ and then pod install but I still have this issue.
@RanLearns which files/directories did you delete? But this might not apply for us not using carthage.

@vinjegaard I deleted the framework itself from Xcode, which deleted the associated files. good luck.

Xcode 11
Module compiled with Swift 5.1 cannot be imported by the Swift 5.1.3 compiler.

According to this stackoverflow question a fix to this issue is to set
_BUILD_LIBRARY_FOR_DISTRIBUTION = YES;_
in Lottie鈥檚 project.pbxproj file.

I solved this problem by : Go to the directory of the prompt, delete the compiled file and recompile it.

BUILD_LIBRARY_FOR_DISTRIBUTION is used for when you are distributing the framework separately from the app (for example if you have a macOS kernel extension and a framework that communicates with it and someone builds an app that can use this if it's installed on the user's machine), which is not the case here. Just delete derived data and previous build products and you should be good to go.

I'm facing the same issue after upgrade to 0.62 version when I run react-native run-ios, but I can run my project via Xcode. Error:
error: module compiled with Swift 5.1.3 cannot be imported by the Swift 5.2 compiler

When this will be enabled? Why can't Lottie add BUILD_LIBRARY_FOR_DISTRIBUTION to its project.pbxproj file?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

WZBbiao picture WZBbiao  路  5Comments

JALsnipe picture JALsnipe  路  4Comments

loganblevins picture loganblevins  路  3Comments

RamblinWreck77 picture RamblinWreck77  路  3Comments

Ushaka picture Ushaka  路  5Comments