'Xcode 13: How to add library search path for "library not found for"

When building a React Native 0.66 project today (used to be working), there is error complaining about library not found for a module which is located at my-proj/node_modules/aliyun-oss-react-native/. After react-native link alien-oss-react-native and pod install, the error remains. Some post suggests adding search path on my-proj->Building Setting->Linking or Search Paths. There are quite a few files under my-proj/node_modules/aliyun-oss-react-native/iOS/, 2 questions here: 1. which path shall be added to Xcode (such as my-proj/node_modules/aliyun-oss-react-native/iOS/)? 2. Shall the path be added to both Linking and Search Paths in Xcode?

Here is the screen shot of Search Paths in Xcode:

enter image description here

Under TARGETS, myproj->Build Settins, Other Linker Flags, the module lib which causes error is listed as first one. My guess is that all libs under the Other Linker Flags may not be recognized by Xcode. Not sure how this happens.

enter image description here



Solution 1:[1]

Try to make search paths "recursive".

Solution 2:[2]

The solution works here is open the myapp.xcworkspace in Xcode instead of myapp.xcodeproj. The build upon workspace went through without any error.

Solution 3:[3]

The "library not found" errors occur most of the time because installing the react-native node package and running pod install is often not enough. The error might go away after running a clean build in xcode using the xcworkspace file. After that running "npm run ios" or "npm start" in your termal should work again.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Roman Mykitchak
Solution 2 user938363
Solution 3 Noah Kanyo