ld: library not found for -lCocoaAsyncSocket - React Native - ios

I have created a new react native project and when I try to run the app within an iOS emulator it always crashes.
When I open the .xcworkspace within Xcode I get the following error.
I have tried to update the search paths but this has not worked, I have also tried to reinstall pods but this hasn't worked.

This must be fixed on the framework side, however, the solution is the following steps:
On the Xcode bring the Build Settings tab
Find the Search Paths and then try to modify Library search paths
Add ${inherited} to the first of the list. It's important to be the first
Delete the build folder inside the ios folder of the project
Try to run the project again
It must fix the issue

This issue is basically related to the wrongly linking classes. Please follow these steps:
check make sure, you have install all the pods.
Please check your .js files, and check your import statements. To be make sure , every import statement package is installed in your project
clean project
Rebuild again

I can see that you state you have already checked search paths, but I had this same issue, and it was resolved by adding "${PODS_CONFIGURATION_BUILD_DIR}" as recursive to my Library Search Paths, under <Project> > Build Settings > Library Search Paths. However, now I'm stuck on the linker instruction -lcrypto, so it's not a complete solution.

Related

Library not loaded- Alamofire

I have been plagued by a bug for hours. I am building a framework using Alamofire and am testing it in an iOS project. Whenever I run the project, I get this error:
dyld: Library not loaded: #rpath/Alamofire.framework/Alamofire
Referenced from: /Users/theodorestrauss/Library/Developer/Xcode/DerivedData/TGClient-ecnnvvvxipoufihfghkpxlfccyoc/Build/Products/Debug-iphonesimulator/TGClient.framework/TGClient
Reason: image not found
I have scoured the web looking at GitHub issues, Stack articles, and more. I've cleaned, deleted Derived Data, added and deleted frameworks from embedded binaries, etc.
For anyone out there, this is not a duplicate. All other questions and answers are outdated.
If anyone can help, I'd immensely appreciate it. Thanks so much in advance. Cheers,
Theo
Make sure your build settings > Runpath search paths have be
• #executable_path/Frameworks
• $(inherited)
Also in your framework search path below entry is there
"$PODS_CONFIGURATION_BUILD_DIR/Alamofire"
This is what I do when I have this problem (and it really works!):
Remove Alamofire framework from target/embedded libraries and target/linked frameworks and libraries by highlighting it and clicking the minus sign. (click on your project name in the upper left corner if you don't see these areas in the center of your screen).
Perform a product clean (Shift-Cmd-K).
In Embedded Binaries section, click on the + sign. Add Alamofire. (or drag the Alamofire icon from the left column into this section and drop it there)
Xcode should fix everything, and it should now load onto the device properly.
I was getting this error while using Alamofire 4.5 + carthage, I added the framework as Linked Libraries in the build phase, the app was crashing on start. In XCode 9.1 I couldn't find the option of Embedded framework, so I added a Run Script to copy framework from Carthage and it started working.
So basically this
Add the framework to the build phases as you normally do.
Add the below Run Script
/usr/local/bin/carthage copy-frameworks
$(SRCROOT)/Carthage/Build/iOS/Alamofire.framework
Can you please clear derived data once and build the project again.
Here is how to clear derived data. Open the terminal and simply hit this command.
rm -rf ~/Library/Developer/Xcode/DerivedData
I solve it by unchecking run script only when installing in build phases menu

'Framework not found' in Xcode

I know this has been asked a couple of times. I followed instructions from these ones:
Adding frameworks to project in Xcode 5 and having *relative* paths added
xcode4: Linker error: Directory not found for option
Still Xcode is giving this error:
Here's my current configuration:
The bolts framework is so I can use the Parse SDK. I downloaded the blank project from here: https://parse.com/apps/quickstart#parse_data/mobile/ios/native/new
It's working. I tried to copy every config option, but it still doesn't work.
Try deleting Bolts.framework from linked framework and re-add it. Also, in your Framework Search Path keep path until Bolts.framework like $(PROJECT_DIR)/Bolts if it is inside Bolts folder at your project directory path.
I'm pretty new to iOS development. Apparently this problem for me was a result of opening the .xcodeproj Xcode project instead of the .xcworkspace Xcode workspace. I opened the workspace instead and the error has gone away.
error: Framework not found
If you use CocoaPods try to run:
pod deintegrate
pod update
Also use .xcworkspace instead of .xcodeproj
Delete the framework link from the Xcode project setting.
Move the framework to the Project Folder.
Re-add the framework in the Xcode project setting.
clean the project and re-compile it.
delete all frameworks from Embedded Binaries and re-add it
me too was getting this error , I moved the framework file to the root project folder and added to framework again and problem is solved.
1:- Delete the framework from the Xcode project. Quit the Xcode.
2:- Open your project in XCode and go to file under Menu and select Add files to "YourProjectName".
3:- Select "YourFramwork.framework" in the directory where you keep it.
4:- Click on the Copy items if needed checkbox.
5:- Click Add.
Make sure that you have the framework added in both Embedded Binaries and Linked Frameworks and Libraries under Target settings - General. As shown in the following images:-
Here is the solution :
Turn the "$(PROJECT_DIR)" attribute(might be non-recursive by default) into recursive option in Select Project Click on Targets Click - Build Settings Search for 'Framework Search Path' - Double click the input.
Scratched from https://stackoverflow.com/a/31298214/4493512
Besides from removing the framework from the Podfile and Linked Frameworks and Libraries, I also had to remove the reference to the framework in Other Linker Flags.
I just had the same situation (was having a hard time to address the OP's build error after adding a 3rd party framework) and it seems like a bug in Xcode (mine is 8.3.2 (8E2002)).
The problem was that a folder name in path to the framework contained spaces. In this case, Xcode incorrectly escaped them with backslashes like this in Build Settings -> Framework Search Paths:
$(PROJECT_DIR)/Folder\ with\ spaces/Lib
To fix this, just manually edit the entry to remove those backslashes and enclose the whole string in quotes like this:
"$(PROJECT_DIR)/Folder with spaces/Lib"
Delete the framework that is causing the issue (by removing the reference).
Then add it again, following these steps for adding FBSDK frameworks and libraries:
click project
general settings
linked framework and libraries
click the plus button and add all that you want
None of the above worked for me until I found that I had a blank "Any Architecture | Any SDK" line underneath Framework Search Paths / Debug under Build Settings.
Deleted the line and it works!
Error: Framework not found
If you use CocoaPods try to run these commands from terminal:
Intel chip:
pod deintegrate
pod update
Apple Silicon M1 chip:
pod deintegrate
arch -x86_64 pod update
Also use .xcworkspace instead of .xcodeproj
When this error occurred to me was because Pods folder was in iCloud and had no local copy on my computer. Go to your project's folder in Finder and check if there is iCloud's symbol in any of the folders inside it!
I realised that I hadn't run/built my framework with the Generic Device, which strangely lead to these issues. I just put the framework back in and it worked.
If you are using CocoaPods. Similar thing has happened to me. Although this question is old someone like me might still be struggling. So for to help:
after pod install it warns you about project files. I didn't notice till now. it says:
[!] Please close any current Xcode sessions and use
ProjectFile.xcworkspace for this project from now on.
So basically, do not continue working on .xcodeproj after installing Pods. If you do linker won't find files.
My framework has long name like FrameworkSDK_Light-1.0.6.framework so I renamed it to FrameworkSDK_Light.framework and it solved my problem.
I got the error 'AdBrixRM framework not found'. I checked the AdBrixRM.framework. I noticed that 'AdBrixRM' excution file is missed. I copied this file into the framework folder and the issue was gone.
I used to encounter this same exact issue in the past with Google Admob SDK. Most recently, this happened when trying to add Validic libraries. I tried the same old good trick this time around as well and it worked in a jiffy.
1) Remove the frameworks, if already added.
2) Locate the framework in Finder and Drag & Drop them directly into the Project Navigator pane under your project tree.
3) Build the project and Whooo!
Not sure what makes the difference, but adding the frameworks by the official way of going to the section "Linked Framework & Libraries" under project settings page (TARGET) and linking from there does not work for me. Hope this helps.
I found that the file.framework was referencing a file outside my project. So I dragged the file into my frameworks folder under my project and then got rid of the earlier file.framework file and it worked.
add github "BoltsFramework/Bolts-iOS" on your cartfile.
then carthage update.
after copy Bolts.framework from ../carthage/Build/iOS
Switching from iOS simulator to real device solved the problem for me.
Was facing the same error and solved it ---> Build Settings > Build Active Architecture Only = Yes
Please after adding both framework also open each Bolts and Parse framework and add Parse and Bolts to the project then problem will be solve
Running pod update in the root directory of the app fixed the issue for me.
If you are developing one module using cocoapods, try to comment the line
s.vendored_frameworks = "YOURMODULE.framework"
on YOURMODULE.podspec
The error will disappear after you generate and copy your YOURMODULE.framework to your project folder.
I had this issue on one of the project i worked, before you delete and readd the framework do a:
git status
on your project and check to see if the framework is not listed as deleted. In the event that it is either do a
git stash
or
git checkout *framework/file/path*

Xcode 6 can't find framework header files when project name contains spaces

I'm using the Parse and PubNub SDK in my project called My Sample App and since I updated my Xcode to 6.3.1 I can't run the project because Xcode doesn't find the header files. I had the same issue with the previous version, but then I just needed to delete and add them again to make it work, unfortunately it doesn't work now. I also tried to delete the Library Search Path and Framework Search Path without any success. Is there any trick that fixes this issue?
This is the exact error:
'PNImports.h' file not found
Add $(PROJECT_DIR) to your Library Search Path in project settings AND select recursive option
Surround Library Search Path with single quotes

Framework header file not found (iOS pop framework)

I'd like to install facebook's pop framework. I have a multi-project workspace which is not using cocoa pods. I want just the simplest, dumbest, quickest install.
From the pop readme:
"... you can add the project to your workspace and adopt the provided configuration files or manually copy the files under the pop subdirectory into your project. If installing manually, ensure the C++ standard library is also linked by including -lc++ to your project linker flags."
I added pop.xcodeproj to my workspace.
I added "pop.framework" to to
the project that needs pop (general > linked frameworks and libraries).
I added "-lc++" to my project linked flags (in the project that needs pop).
Added #import <POP/POP.h> to my .m file.
The result: "POP/POP.h" not found.
I guess I'm doing something wrong, but absolutely no idea where to start looking.
I set the Built Setting of my project, then it worked.
User Header Search Paths = $(SRCROOT) // recursive. Pop is placed in the directory
Always Search User Paths = YES
This setting worked for me:
in podfile:
pod 'pop'
in project > target > build settings
always search user paths YES
add search path:
Take a look at this:
How to add facebook open source code pop to project directly
I also discovered that the -lc++ flag actually caused a linker error. I followed the instructions in that link and removed the flag and everything worked!
You could try this...worked for me as I'm also adding pop as static library, instead of using CocoaPods:
Download source code from this tutorial, because we'll be adding the library files with quotes "POP/POP.h" instead of < POP/POP.h > and all files are already changed here, just copy/paste the "pop" folder from the example project to your project: http://tapity.com/tutorial-getting-started-with-pop/ You can alternatively change all files you already have inserting quotes.
In your project create a subdirectory called "pop" (File/New/Group) with another subdirectory inside called "WebCore". It's important that you create these subdirectories so they will appear as yellow "folders" (instead of blue folders) and Xcode will compile the files properly. You can check if POP files are being included in Build Phases / Compile Sources.
Add the respective POP files inside these empty subdirectories respecting the same structure of the source project (i.e. File/Add Files to "project" inside each subdirectory).
Now just #import "POP/POP.h" and start using pop animations. Doing this way there's no need to add pop.xcodeproj to your workspace.
After trying all of these solutions, what worked for me was actually was lowering the Deployment Target from 9.3 to 8.0.
Be careful of the order of your framework search paths. I had another project which I was referencing modules from that had a different version of the framework library and because that project was higher in the framework search path ranking it was picking up the incorrect header files too.
Those who suffers from it. My problem was like this,
I was having trouble with swift and xcode 8 build times. So i changed my scheme Edit Scheme -> Build -> Find Implicit Dependencies (Uncheck). I was not get trouble with simulator i was having trouble with device. So when i change it to check again it worked. And then made uncheck or vice versa.

directory not found Apple Mach-O linker warning but Library Search Path and Framework Search Path are empty

I'm getting these messages:
ld: warning: directory not found for option '-F"/Users/joel/Development/GHaikuTabbed"'
ld: warning: directory not found for option '-F"/Users/joel/Development/GHaikuTabbed/../../../Downloads"'
But when I go to Build Settings (as suggested at ‘ld: warning: directory not found for option’), Library Search Path and Framework Search Path are empty, so there's nothing to delete.
Thoughts on other things I can do to get rid of this warning?
Here is a description how to avoid a problem based on Apple Dev Forum posted before. It works for me so I repost description for those people who don't want to go and register at the forum.
The bug is due to an error in XCode 5 when it deals with the user adding new files or folders to the project.
Xcode is modifying the 'Library Search Paths' build setting, and making a god-awful mess of it.
Instead of adding $(SRCROOT)/ it is adding fully rooted paths to all new items, and adding random amounts of /// into other elements of the string.
It also seems to be duplicating source paths in some instances, probably because it's broken the existing ones, and thinks they need adding again.
The solution:
Copy out your Library Search Paths string into a text editor.
Remove any fully rooted paths that shouldn't be there, and replace them with the usual $(SRCROOT)/MyFiles/ type paths.
Remove all extraneous slashes and make sure each path has a " character at beginning and end to protect against spaces in filenames.
Paste the edited string back into Build Settings.
Clean, then Build. Should be back to normal.
This error may well recur if you add new files to your project, so beware.
My project.pbxproj looked like this:
LIBRARY_SEARCH_PATHS = (
"$(inherited)",
"\\\"$(SRCROOT)/AdMob-v6.4.1\\\"",
"/MyProject/AdMob-v6.5.1",
);
I closed MyProject, deleted the line containing AdMob-v6.4.1, reopened the project, performed a "validate project settings", cleaned, and built, and now all is well.
Yeah, Xcode is jenky sometimes.
Did you try cleaning your build (Product > Clean Build Folder / Shift-Cmd-K) and trying again?
Another thing you can do is to search for the two entries in [project_name].xcodeproj/project.pbxproj, remove them, close XCode, re-open, Clean Build Folder and try again.
Good luck!
To summarise what #user2963906 is suggest, I show my solution to this problem, which I think much easy.
I assume that you have all your files and libraries in your project folder.
Open your project Targets
Find Search Paths topic and Library Search Paths
Choose and remove all paths here
Then add path like this: $(SRCROOT)/"Your App Name"
In the same window change drop-down list from the right from non-recursive to recursive
Shift-⌘-K and Run your project
I found a solution for this with my case on the iOS Developer Forums. It happened to me with Xcode 5. See Massive Linker Error Warnings (directory not found for option) yet . For me it was caused by Xcode 5 junking up the "Library Search Paths" build setting.
Easy Solution :
It's work for me
when you want to add new files or folders to the project through xcode 5 and above error display.Just follow below simple step.(Please don't forgot to get backup of your project).
Open your Project in Old XCode (I recommend XCode 4.6.3)
Add your files or folder. (it will not mess your library search path as it mess in XCode 5)
Close the old xcode and open your project with XCode 5 and start to code.
I faced the same problem but was unable to fix it as per the steps since no library folders were getting displayed in the Project properties window.
So I solved it in another way (you need to be able to use the Terminal and the VIM editor. Also take a backup of the project just in case)
Open a Terminal window
Go to the project folder.
The XCode project is a folder. use cd project name to go into that folder.
use vim to open and edit the project.pbxproj file.
Remove reference to the offending lines by searching using / and using the dd command on that line to delete it.
Save using :wq command
Open the project in XCode and build. Works like a charm.
I had to escape any spaces with a \
So for example:
/Users/Me/Folder\ with\ spaces\(and\ brackets\)
in Library Search Paths
This worked for me :
Create this real directories (with no content), add them to project, remove via remove reference, clean, delete for real
In project folder -> target , under 'Build Setting' search 'library search paths' and simply delete previous path in Debug & Release area.
Now add the line below line using + symbol
$(PROJECT_DIR)/Library
Note: After adding the above line click out from popup. its automatically display the full path.Then check this path with your Finder if any correction add after the $(PROJECT_DIR)/
Clean , Build and Run … Simple its cleared that error. :)
-Anup

Resources