react-native-fbsdk FBSDKCoreKit and FBSDKShareKit not found - ios

I have installed the facebook SDK properly. (This is different from the other not found error because it is specifically for react-native-fbsdk and none of the solutions worked.)
I have tested that I have the SDK installed by importing both the FBSDKCoreKit header and FBSDKShareKit header into AppDelegate.m and it compiled and ran with no issue.
However when I installed react-native-fbsdk and linked it and compiled, I get the error of 'FBSDKCoreKit/FBSDKCoreKit.h' not found. similarly with FBSDKShareKit.
The troubleshooting on the github page gives 3 options to check when this occurs:
Make sure that the Facebook SDK frameworks are installed in ~/Documents/FacebookSDK.
Make sure that FBSDK[Core, Login, Share]Kit.framework show up in the Link Binary with Libraries section of your build target's Build Phases.
Make sure that ~/Documents/FacebookSDK is in the Framework Search Path of your build target's Build Settings.
Which I have checked and verified that I had all of these there was no solution found. The strange thing is that I can import them in AppDelegate.m and it works fine.

You need to make sure you have the SDK frameworks saved under the folder ~/Documents/FacebookSDK
Because react-native-fbsdk iOS project have the value "~/Documents/FacebookSDK" hardcoded in its own definition of Framework Search Paths

If you are like me and don't want to do what Facebook tells you (or you don't want to put random stuff on your Documents folder):
Replace every instance of ~/Documents/FacebookSDK in the QuickStart tutorial with the place you do want to store the SDK, in my case ~/Library/FacebookSDK. That means, unzip the downloaded SDK there and add that route to your project's Framework Search Paths. *
In Xcode's file tree, expand the Libraries group and click on RCTFBSDK.xcodeproj. On that project click Build Settings and add your route to its Framework Search Paths.
And that's it. Just remember you did this when you update the node module, 'cause this change won't be versioned on your project.
*Note: If there are other people working on the project, do not remove ~/Documents/FacebookSDK from your project's Framework Search Paths. This is to be consistent with the module installation and the rest of the team can easily npm install and use the installation guide as documentation.

Drag & drop in Xcode the FacebookSDK files, for example try with FBSDKCoreKit.h

Related

ld: library not found for -lCocoaAsyncSocket - React Native

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.

How to construct a Swift Package that links to a local (not system) library?

I must have read over a dozen posts on possible techniques to link a local library into my Swift Package. Specifically, my package depends on libturbojpeg.a, which most users won't have installed anywhere. Even if they did install it (there is a DMG), I'd have to go through hoops to make sure I was linking in the correct version. I finally found a post in the Swift Forums that basically says you can't do it now.
It appears that the only way to link it now is using .linkerSettings(LinkerSetting.unsafeFlags(..., but if you use that your package can't be managed by Xcode (see above link, and I even tried it and verified it cannot be used).
Is there some kind of workaround that allows me to distribute my Swift Package with the library?
In my Package, I created a directory "Libraries" and added my library there.
I discovered that Xcode 11 places included Swift Packages in a specific location in the Derived Folders directory. This means that it is possible to tell Xcode where to find it during the link phase.
My Package has these instructions in it for users:
1) Add the Package using Xcode->File->Packages with the URL of https://github.com/dhoerl/
2) Open the app's Project Build Phases, and from the Package shown in the left file pane, drag the Libraries/.a file into the link phase. It will appear just above the that should already be there
3) In Application Build settings, under library search paths, add:
"$(BUILD_DIR)/../../SourcePackages/checkouts//Libraries"
Build and run! VoĆ­la - works like a charm!
Note: obviously this is somewhat fragile, Xcode 12 could change how packages are managed, but its possible by then that the Swift Package Manager will support linking of local libraries (its mentioned in the above link.)

Problem compiling React native project on ios

I get errors of not finding the React/reactLog.h file and more files from various react native libraries.
Have tried cocapods and it says it is installing, but it seems as if it's not installed in any libraries.
The error is:
'FBSDKSharekit/FBSDKSharekit.h' file not found
Well, in any case you have to follow the instructions again from this link and double check everything:
https://github.com/facebook/react-native-fbsdk
However, in my opinion this error occurs if you don't download and put the FacebookSDK in your document folder and drag and drop it into your project. So check if you have downloaded it and put it there please. After Putting it there, you should go in your Xcode project in the Library -> RCTFBSDK.xcodeproj path and drag and drop FBSDKSharekit file from your facebook SDK folder(In your document folder) into the framework folder. You have to do the same thing with FBSDKCore and FBSDKLogin.
In addition you should check these two points:
1- FBSDK[Core, Login, Share]Kit.framework show up in the Link Binary with Libraries section of your build target's Build Phases.
2- Make sure that ~/Documents/FacebookSDK is in the Framework Search Path of your build target's Build Settings.
Then try to clean and compile the project. I hope it helps you.

Trouble with an .h import

As a beginner in ObjectiveC I need some help.
I'm working on a phonegap plugin for IOS (so, written with objective C). I use some open source code but I got an error with an .h import.
My architecture look like:
myFmk.framework/
myFmk.framework/ABCDE/myFmk.h <== in a sub folder
myFmk.framework/myFmk <=== this is a file
myPlugin.h
myPlugin.m
In myPlugin.h I have #import and in "myFmk.framework/myFmk" file I have only one line "ABCDE/".
I thought that this file do a redirection of the absolute import (with brackets) but my complier told me that "myFmk/myFmk.h" is not found.
I tried to find some documentation about this feature but I wasn't able to find its name... do you have this documentation or the feature name?
Thks.
Is the framework added using a cocoapod? If not, did you follow the instructions properly for adding it to your project? It would probably help if you posted the framework you are experiencing problems with.
If this is a framework that is added to your project properly and you are unable to import there are a few things you should check. First, go to your project settings (click on the project at the very top of your file tree in the left column) and then look for "linked libraries". See if the library is listed there. If not click the + and try to add it.
If this framework was added via cocoapods another thing to check is search your file structure for libPods.a. If it is red, I find sometimes it is helpful to delete it, close the project and run pod install again.
Also if you installed the project via cocoapods remember to open the workspace and not the old xcode project file.
I have also experienced this problem when my header search paths and other linker flag paths were wrong. Linker Flags should be $inherited if this is a cocoapod. In my projects most Header search paths are $inherited too.
If none of this is helpful please provide more information such as how this framework was added to your project and what the framework is. Also let us know if you get any error messages.

Facebook SDK does not work after bitbucket pull in other computer with Xcode project

I have a project where I am using FacebookSDK framework. I have followed the guide and everything works well in my computer, the problem is when I make a push into bitbucket repository and one mate make pull in his computer to work with the project there.
He gets this error FacebookSDK/FacebookSDK.h file not found.. We have looked in Framework search paths and the path had different user name ( my computer's name).
Which is the good way to install it? We have downloaded both FacebookSDK.pkg and installed it. its default path is /User/USERNAME/Documents/FacebookSDK/.... I have tried like they do in the video and I have added the Framework and bundle file into Framework folder of xcode without copy it.
I also have tried to put the framework in the Project folder and then add then add to the xcode project. it does not work either.
So, how people do this when they work in a work group with BitBucket or github(I guess is the same)
I also have this warning, APPLE MATCH-O LINKER WARNING ld: warning: directory not found for option '-F/Users/xxxxxxxxx/Documents/OS/project_name'
ld: warning: directory not found for option '-F/Users/xxxxxxxx/Documents/FacebookSDK'
In Project/Build settings Framework Search path when we make commit we have both paths..
I added the facebook sdk by following method
Click on the Project->Target->Link Binary with Library-> + -> add other and go where your frame work is, it should be in documents.
here you go. !!!!

Resources