xcode librarby not found for -IRCTNetwork - xcode

I have react native project that I'm trying to run with xcode.
when i run it shows me the error
ld: library not found for -lRCTNetwork
clang: error: linker command failed with exit code 1 (use -v to see invocation)
actually, i don't know what is -RCTNetwork,
it's not any plugin I installed.

This error occurs because you haven't added or linked the network library to your Build Phases in Xcode.
Drag the file, RCTNetwork.xcodeproj from node_modules/react-native/Libraries/Network/
to the libraries file in Xcode.
Then click on Build Phases on the top right-hand corner in Xcode.
Click the drop down of Link Binary With Libraries, then the + sign to add the libRCTNetwork.a
Run the build and restart your emulator or device.

Related

iOS build: command ld failed with a nozero exit code

For a react-native project, I got the following error during Xcode build:
clang: error: no such file or directory: '/Users/user172615/Library/Developer/Xcode/DerivedData/xxx/Build/Products/Debug-appletvsimulator/libBVLinearGradient.a'
Command Ld failed with a nonzero exit code
This happened after adding react-native-linear-gradient, and following the instructions in https://github.com/react-native-community/react-native-linear-gradient (manual installation for iOS).
As specified in https://github.com/react-native-community/react-native-linear-gradient#manually, libBVLinearGradient.a is included in Build Phases -> Link Binary With Libraries for the target myProject
libBVLinearGradient.a is also included in General -> Frameworks, Libraries and embedded content.
I tried deleting DerivedData, and rebuilding. Didn't help.
Since the error indicates Debug-appletvsimulator, I included libBVLinearGradient.a in Build Phases -> Link Binary With Libraries for the target myProject-tvOS
When this didn't help, I deleted the myProject-tvOS target. All didn't help.
I am using Xcode 11.3, react-native 0.59.9.
Any idea?
Instead of downloading it, do this instead.
Click on clone existing project
Then copy this link
https://github.com/react-native-community/react-native-linear-gradient
And paste the link here
Then it will download the project.
If the problem still happens, then create a new project, copy and paste everything.

AFNetworking - ld: library not found for -lAFNetworking

I have an Xcode project with Cocoa Pods installed which I added a tvOS single view app target. I shared with the tvOS target all the pod installed. When I build and run my iOS target everything is ok, but when I run the tvOS target I get this error
"ld: library not found for -lAFNetworking clang: error: linker command failed with exit code 1 (use -v to see invocation)"
So after searching on the web I found a solution to this error. If I go to the Build Settings for the tvOS target and under Valid Architectures I remove arm64 and type armv7 the error disappears but then when i run the project i get this: the file couldn't be opened because you don’t have permission to view it.
First, you must sure you're opening the .xcworkspace file, not the .xcodeproj file.
Then, open your project folder and run command pod install and reopen .xcworkspace file it will fix your issue.

Adding Facebook SDK to a project without CocoaPods in Xcode 10

I'm not able to build my app with the Facebook SDK in iOS 10. I've included both the "Bolts.framework" and "FBSDKCoreKit.framework" frameworks to my projects. I've also added my Facebook SDK folder to the "Framework Search Paths" in "Build Settings". This is the folder that contains these frameworks.
I'm getting this error and I'm not sure how to resolve it. My project compiled fine in Xcode 9 but won't compile in Xcode 10. Is there another step I'm missing in Xcode 10?
'FBSDKCoreKit/FBSDKCoreKit.h' file not found
UPDATE: Xcode seems to not be able to find the frameworks. This is the error I'm getting. I dragged the frameworks into Xcode from that folder. If I right-click on the framework and click "Show in Finder" it goes right to the frameworks so I don't understand my Xcode can't locate them.
ld: warning: directory not found for option '-F~/MY_FOLDER/FacebookSDK'
ld: framework not found FBSDKCoreKit
clang: error: linker command failed with exit code 1 (use -v to see invocation)
UPDATE 2: Even if I remove that folder from my build options Xcode still complains it can't find the frameworks. I have to completely delete them from my project in order to build successfully.

XCode 8 - Build works but archive fails - React Native

I have an haunting issue. I am trying to build an React Native app in Xcode 8. Build/Run in Simulator works fine but as soon I start to archive I am getting the following error:
Apple Mach-O Linker (ld) Error Group
clang: error: linker command failed with exit code 1 (use -v to see invocation)
That's the only error and it's after all steps have been completed with no further explanation.
Now I installed Fastlane and found out that it fails because of duplicate symbols. Removing the duplicates from "Linked Frameworks and Libraries" solves the issue and allows me to archive the app.
However now I can't build anymore for the simulator because of missing symbols.
I been looking into this for 2 days now and I can't find a solution.
Anyone has an idea why this is happening and how to solve it?
I found the solution for it!
Based on this thread https://github.com/facebook/react-native/issues/12814 if you use Pods, it also includes the base react project which will end up causing the duplicate references.
In order to fix this issue, the react reference need to be removed:
Open your [yourproject].xcworkspace
Select your Pods project
In TARGETS delete React. (clicking on the minus button - below of the targets list.)
Clean (Product > Clean) & archive/build/whatever.
Kudos to andfk for this solution!

XCode tests. Clang: error: linker command failed with exit code 1 for FBSDKCoreKit

I added new Tests target to my project, but I have this error even I don't use any FBSDKCoreKit dependencies in the tests. Generally I use CocoaPods, but not for FBSDKCoreKit framework. Tried everything — no results.
ld: framework not found FBSDKCoreKit
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Normal Run builds are working perfectly, just tests are not running.
In the test target settings:
My mistake. I just didn't follow all steps from FB doc:
Drag the FBSDKCoreKit.framework, FBSDKLoginKit.framework, and FBSDKShareKit.framework files into the Frameworks group of Xcode's Project Navigator. In the displayed dialog, choose Create groups for any added folders and deselect Copy items into destination group's folder. This references the SDK where you installed it rather than copying the SDK into your app.
Open Xcode's Build Settings tab in your project.
Add ~/Documents/FacebookSDK to the project's Framework Search Paths setting.
https://developers.facebook.com/docs/ios/getting-started/

Resources