lottie-react-native: Could not find or use auto-linked library 'swiftWebKit'

Description

Error raised when building the app.

Steps to Reproduce

  1. run build in the xcode app.
  2. error when building

Expected behavior: build the app without such error.

Actual behavior:

ld: warning: Could not find or use auto-linked library 'swiftWebKit'
Undefined symbols for architecture arm64:
  "__swift_FORCE_LOAD_$_swiftWebKit", referenced from:
      __swift_FORCE_LOAD_$_swiftWebKit_$_lottie_react_native in liblottie-react-native.a(ContainerView.o)
      __swift_FORCE_LOAD_$_swiftWebKit_$_lottie_react_native in liblottie-react-native.a(AnimationViewManagerModule.o)
     (maybe you meant: __swift_FORCE_LOAD_$_swiftWebKit_$_lottie_react_native)
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Reactions: 11
  • Comments: 26 (4 by maintainers)

Most upvoted comments

I already had a File.swift in my project. I upgraded from 0.66 to 0.67 and got the error mentioned by the thread author.

My solution was to delete the following path from the LIBRARY_SEARCH_PATHS setting as you can see with React Native Upgrade Helper:

CleanShot 2022-02-28 at 09 57 40

Go into Xcode and delete the following line:

CleanShot 2022-02-28 at 09 57 09

https://github.com/facebookarchive/react-native-fbsdk/issues/755

creating File.swift is not working in xcode 13.

Just open your project/ios with xcode, then add a new swift file and that’s it!! your problem is solved. at least it worked for me

Exactly the same after upgrading to RN 0.64

Also add "$(SDKROOT)/usr/lib/swift\" to LIBRARY_SEARCH_PATHS can help if you want to remove File.swift

oh, you mean the bridging header on the main project, not on the lib. Ok, I will update the documentation accordingly. Thanks!

this worked for me https://developer.apple.com/forums/thread/655438

Figured this out. There is a new library in Xcode 12 that needs to
 be added to the Link Binary with Libraries phase call libSwiftWebKit.tbd. 
Error went away after adding this.

Unfortunately, adding this library breaks compilation with Xcode 11,
 so you'll have to add & remove it depending on which version of Xcode you're using.

@kockok , make sure to create File.swift + bridging header on the correct level https://teabreak.e-spres-oh.com/swift-in-react-native-the-ultimate-guide-part-1-modules-9bb8d054db03 **

  • In the Group dropdown, make sure to select the group CounterApp, not the project itself.

**

Just open your project/ios with xcode, then add a new swift file and that’s it!! your problem is solved. at least it worked for me

how to do that please ?

The following is your project structure:

  • your-react-native-project |- ios |- android

    the content the ios folder is an xcode project

    you must to open this folder with the xcode and then add a new file swift file

Screen Shot 2021-07-20 at 14 05 50

Screen Shot 2021-07-20 at 14 06 07

@emilioicai it might be easier to describe the steps to take when you upgrade to RN 0.64. There are other 3rd parties libs out there that documented exactly these steps. A great how-to can be found -> https://teabreak.e-spres-oh.com/swift-in-react-native-the-ultimate-guide-part-1-modules-9bb8d054db03 You would only have to take the steps till the prompted where you choose to configure Objective-C Bridging Header.

Hope that helps.

I already had a File.swift in my project. I upgraded from 0.66 to 0.67 and got the error mentioned by the thread author.

My solution was to delete the following path from the LIBRARY_SEARCH_PATHS setting as you can see with React Native Upgrade Helper:

CleanShot 2022-02-28 at 09 57 40

Go into Xcode and delete the following line:

CleanShot 2022-02-28 at 09 57 09

facebookarchive/react-native-fbsdk#755

Oh god, such a legend. Thank you.

Also add "$(SDKROOT)/usr/lib/swift\" to LIBRARY_SEARCH_PATHS can help if you want to remove File.swift

Works for me, but needed to remove the trailing "".