Lexical or Preprocessor Issue 'FacebookSDK/FacebookSDK.h' file not found - ios

I just add facebookSDK.framework in ios project through this document :Getting Started with the Facebook SDK for iOS
I have successfully build and run my Xcode project by following it. But when I copy my Source code and run it on another PC following error is coming
"Lexical or Preprocessor Issue 'FacebookSDK/FacebookSDK.h' file not found"
I was also add facebookSDK.framework in my Project's resource and try again but not solve it.
So, Please tell me how to do for run this project in other place.

I have a very similar issue, but in my case it is with the Amazon Web Services SDK instead of the Facebook SDK. For me the problem turned out to be related to my framework load path.
Solution: Go to "Build Settings" in Xcode, and under "Search Paths" there is a "Framework Search Paths" item. Double-click it and add a new search path: . and make it recursive. Clean and build.
This assumes that your framework is stored somewhere inside your project directory. If not, change the new search path as needed.

I had this problem and fixed it by doing this:
Delete the FacebookSDK framework from your project.
Delete any references to the Facebook SDK from your "Framework
Search Paths" and "Header Search Paths" in Build Settings (be aware
this setting exists both under 'Project' and 'Target', so clear it
from both places)
Clean your project, save and quit.
Relaunch your project.
Re-add the Facebook SDK framework by dragging into your project.
Compile. At this point, it was fixed for me.

In my case I did things similar to you (one thing is different), it worked for me. The steps are below:
Go the FacebookSDK directory, select FacebookSDK.framework, right click and press get info then copy the file path.(something like : /Users/macbook/Documents/FacebookSDK)
Go to "Build Settings" in Xcode, and under "Search Paths" there is a "Framework Search Paths" item. Double-click it and paste the file path that you just copied.
Be aware this setting exists both under 'Project' and 'Target', so paste it in both places.
Clean project and build. This time it should work.

My solution to the Lexical or Preprocessor Issue - file not found error, was as follows:
Go to Xcode => Project Target => Build Settings => Search Paths
Then insert the following path in both Framework Search Paths and Library Search paths, using your own project name in this path:
"${SRCROOT}//project name/facebookSDK/framework"

I solved this error message by dragging the DeprecatedHeaders folder from the Facebook SDK (it lives in FacebookSDK/Versions/Current) into the Frameworks folder, next to the FacebookSDK.framework.
Adding all manner of search paths (including . as suggested above) did not help, nor does the answer from Mr_bem help - the .m file already existed in the "compile sources"
This may not directly help with the OP's question, but may hopefully help others like me.

In my case the problem was with MillenialMedia SDK:
Lexical or Preprocessor Issue 'MillennialMedia/MMSDK.h' file not
found
It was solved by removing SDK frameworks from project, moving frameworks to Project's top-level folder (Where stored .xcodeproj File). And then adding Frameworks to Project in Build Phases.
Sometimes you need to re-download SDK archive form official website (if it was corrupted or something like that). In my case it was happened after pushing my project to remote repository from office computer and pulling it from home computer.
Removing frameworks
Moving framevorks from inner folder to top-level Project folder (Same folder, where your .xcodeproj file is stored
Adding frameworks back to the project

Click on the blue icon from your files browser in xcode (the top one with your project name)
Click on targets, then build phases.
Expand compile sources.
Add your Facebook.m files there.
That should do it.
If not, just clean your project (command + shift + k), and then re-add the framework (Y).
If you have any more questions, just ask ;D

I have same problem. Maybe you used tortoiseSVN (windows) to checkout source code.
This is my problem:
Mac => submit source => Window => checkout source => Copy source from window to Mac => compile => error.
Solution: using svn for Mac to checkout source.

When I had this problem I found that the project came back clean but when I tried to run it I got the error. If I commented out the facebook.h files then it just switched to the next files in my prefix file and still created the error.
I was ready to start changing the build settings and search paths but decided to close all my Xcode projects and restart it first which worked for me.
Writing this it seems almost too obvious a thing to try but as soon as the error appeared I was onto stackoverflow and trying the answers suggested above. My situation might be rare and unique but definitely try restarting and closing everything first as it only takes 10 seconds and worked for me.

In my case it was Xcode and its lovely feature of F***ing up stuff :)
Solution: Go to "Build Settings" in Xcode, and under "Search Paths" there is a "Framework Search Paths" item. Make sure you don't have slashes before the quotes, which are usually added when you add a framework via the "Add files to..." on Xcode.
If you see slashes before the quote, remove them.
example:
\"
Should be
"

Ok guys, I think i got the answer. Follow the steps given below.
Copy your framework into your project.
Make sure it is under some directory. e.g.$(PROJECT_DIR)/project_name/Resources/Frameworks
Click on the target.
Goto Build Phases->Link binary with Libraries
Add the custom framework by clicking "Add Other"
Verify in the project navigator that the framework exists only once.
Now goto Build Settings->Search Paths->Framework Search Path and make sure that it has the following two things.
(a) $(inherited)
(b) $(PROJECT_DIR)/project_name/Resources/Frameworks.
Not to remind the framework exists inside the "Frameworks" folder
Make sure that there is nothing in the library search path.
Now click on the project (above target)->Build settings and repeat steps 7 and 8.
Now clean the project and build the project.
Hope it works.
Please remember not to keep any folder names with spaces. If you have kept them, make sure that you provide the correct escape characters.

I had same problem and find out the reason of this error in my case is because there are more then one "facebookSDK.framework" can be found in the "Framework Search Paths".
You can check all "Framework Search Paths" in your project and make sure Xcode only can find one "facebookSDK.framework" in those paths.

The values in Framework Search Paths and Header Search Paths were initially the same that mentioned here by others.
I checked to link the library manually by dragging it to the Xcode.
FB SDK's library were already present as well.
The problem was with the folder name of downloaded SDK
I renamed it to FacebookSDK and got my app up and running

If you are using this command line for the facebook plugin on IOS
cordova -d plugin add /path/to/cloned/phonegap-facebook-plugin --variable APP_ID="123456789" --variable APP_NAME="myApplication"
And you see the FacebookSDK.framework in your Frameworks but you are unable to expand it.
Go back and use cordova plugin remove phonegap-facebook-plugin then
git clone https://github.com/Wizcorp/phonegap-facebook-plugin.git and then re-add the facebook plugin.

vote539 is correct, but...
Blockquote Go to "Build Settings" in Xcode, and under "Search Paths" there is a "Framework Search Paths" item.
Then double-click the current paths for "Framework Search Paths".
A window will appear. For the item $(PROJECT_DIR)/yourAppName, change from recursive to recursive.
The cause of the issue is that you put your frameworks in a subdirectory, rather them being in the root directory.

Related

“GooglePlus/GooglePlus.h file not found” when trying to build my project

I get the error
GooglePlus/GooglePlus.h file not found
when I try to build the project. I just added the Google Plus framework into the project, and after that, I tried to import the framework in the app delegate.m file, but I’m just getting this error.
Drag and Drop the google-plus-ios-sdk-1.7.1 folder into Framework search path in Build Settings.
Its works fine for me.
I had the same problem, under "Build Settings > Search Path > Framework Search Paths" i had
$(inherited) non-recursive
$(PROJECT_DIR)/My non-recursive
Project/Frameworks non-recursive
i think spaces are breaking the directory path
changing it to $(PROJECT_DIR)/"My Project"/Frameworks solved my problem..
Take note that My Project is my project name, Frameworks is where my GooglePlus.bundle & .framework, in case yours contains spaces, adding quotation marks corrects it.. for example: $(PROJECT_DIR)/"My Project"/"Google Frameworks".
I think you have to remove current framework and bundle for Google plus and then download the latest one framework for Google plus from https://developers.google.com/+/mobile/ios/sdk/google-plus-ios-sdk-1.5.1.zip & add them from project's Build_Settings>Build_Phases.
This way i have solved my problem, may be u too can get it.
Thanks
K.D
I had the same problem and what got it fixed was removing the spaces from the names of parent folder(s) of the framework. With spaces in the names of parent folder(s), Xcode will show multiple directories in "Framework Search Paths".
And sorry, I could not add it as a comment as I don't have enough reputation.
One thing which I was missing adding
-ObjC in linker flag , but it did not removed the error.
Then I removed #import <GooglePlus/GooglePlus.h> from .pch file and added into my ViewController.h. It worked.
I had modified the path of Build Settings->Search Paths->Framework Search Paths to $(PROJECT_DIR)/yourProject/3rdParty/"Google API".
Here, it's important to add the quoter mark. If you miss the mark, then Xcode will know as $(PROJECT_DIR)/yourProject/3rdParty/"Google" and API.
Drug&Drop needed framework from Pods/Frameworks of your workspace to YourProject/Frameworks and select "Directory reference"

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

Header files are not added with framework kit in ios xcode

I'm so new to xcode, I have a speechkit framework with following files as shown in image below
Now When I add this framework to my xcode project the header files are shown empty as below
and I end up with build error 'Lexical preprocessor issue SpeechKit/SpeechKit.h' file not found'. What is the issue with it? How to solve this?
I had the same issue.
Your Header symbolic link is corrupted (others too), you must replace it by a valid Symlink.
You can use ln -s command on each Symlink of your framework or use my script available here :
https://gist.github.com/spawnrider/6088294#file-fix_symlinks_fmk_ios-sh
Another newbie in Xcode here. I also spent a lot of time with this problem.
My scenario is the framework was emailed to me by colleague as a zip file.
I unzipped it on windows and copied it to my Mac. Wrong move. I should have unzipped it on the Mac itself. If you are wondering why your "header" is not a folder, then this is your answer.
The right answer is, that you have to make sure that the files are compiled right. In my case i had to download the SDK/Framework of my choice again.
Delete all files of speechkit in the Project and from the disk
Download it again from your Source
Add it to your project
Make sure you link the Framework (Build Phases->Link Binary with Libraries)
That should make it. I don´t know why it was not compiled proper. But as i followed the steps above, the Framework was compiled right and the Project was built.
Your framework wasn't compiled successfully. You need to add the framework to the "Compile Sources" build phase.
Go to your target's settings and select the 4th tab (Build Phase). Open the "Compile Sources" phase and click on the '+' symbol and add your framework. The lexical/preprocessor issue "'SpeechKit/SpeechKit.h' file not found" should now be solved.
What i found that if you unzip any downloaded sample code and you get any lexical/preprocessor issue then just simply add that framework again by follow these steps Go to your target's settings and select the 4th tab (Build Phase). Open the "Compile Sources" phase and click on the '+' symbol and add your framework by clicking on (add other from sample code folder) option.

library linked but Xcode says "file not found."

This just started happening with my project and I have no idea what to do.
I've been using the Parse framework and everything has been fine so far. But now, even though the library is included:
and linked:
I still get a "'Parse/Parse.h' file not found" error when I import it into classes. Even weirder (at least to me), the project still builds and runs. When I build or clean the project, the warning disappears, but then it reappears right away.
Any idea how I can fix this?
For all who have not found issue:
Go to Build settings and search for "Framework Search Paths", then remove everything and put ./ and make it recursive (by double-clicking on it)
IMPORTANT - Don't download Parse framework on Windows and then copy to Mac! inside framework there are some links and while copying they get corrupted. Download the framework directly from Mac and when added to xcode make sure it has "Headers" folder under it in XCode frameworks.
I hope it helps some people.
have you tried by changing the #import "Parse/Parse.h" to #import ?
The compiler will search for the header files in a special search path. In your case, it seems that the file "Parse/Parse.h" is not in your compiler's header file search path. Check this in your compiler settings.
How many targets do you have? If more than one, maybe the debug target doesn't include the framework.
I have the same problem when I use the demo called "TodoTable", and I solve this by deleting the link in target -> Build Phases -> Link Binary With Libraries -> Parse.framework, and then, adding it again. You may do it by clicking + button, and choosing Add other..., then, in the project folder, you can find the Parse.framework file. After that, rebuilding your project, and it will be ok.

SVG/iOS - How to use SVGKit?

I am trying to include SVGKit (https://github.com/SVGKit/SVGKit) into a test project.
And I get the message:
"libxml/parser.h file not found"
I have checked that the file indeed does not exist on the file system under the project folder.
Neverthe less the demo provided works fine.
Can someone tell me what is going on?
I think you'll need to link libxml to your project. As explained in steps 10 and 11 of "Cross Platform Library Build" on the github page you linked to, just go to Build settings in Xcode, search for "header search paths", double click on it, press the "+" button in the popover, type "/usr/include/libxml2" and make sure "recursive" is selected in the popup button, as I think everything is within yet another subdirectory.
Then add the framework "libxml2.dylib" to "Linked Frameworks and Libraries".
This should fix your problem.
First add libxml2.dylib into your framework
Then go to Project -> Build Settings and search for "Header Search Paths" key and add this value: "${SDK_DIR}"/usr/include/libxml2 don't forget select "all" for Build settings

Resources