#import not finding .h file in Xcode (Version 6.3) - ios

I am unable import the .h file. The file is shown in the Project Navigator in Xcode.
Actually for adding the Localytics SDK, I dragged the SDK folder to the project navigator & 'Add to Target' checkbox selected.
Is it required to add the library to the 'Header Search Path' in the 'Build Settings' ? Presently below values are there in my 'Header Search Path'.
"$(TARGET_BUILD_DIR)/usr/local/lib/include"
"$(OBJROOT)/UninstalledProducts/include"
"$(BUILT_PRODUCTS_DIR)"

Double-click on the Header Search Paths value to open the window that lets you add a new path.
Open a Finder window and navigate so that you can see the folder that contains Localytics.h.
Drag the folder into the search path window.
Change your import to #import "Localytics.h".

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.

Related

how to avoid importing ZBarSDK(libzbar.a) in Xcode Everytime while opening project in xcode

While opening the project in Xcode, I require to import ZBarSDK(libzbar.a) & GoogleAnalytics (libGoogleAnalyticsServices.a )Everytime how to overcome this problem by importing just once.
First Delete the ZBarSDK(libzbar.a) & GoogleAnalytics (libGoogleAnalyticsServices.a ) from your projects.
Now add (Drag)again these two file in your project. Then xcode will ask to copy or set reference in your project. Just Copy it.
then Clean and build your project. Quit xcode and reopen it.
If then also it will ask to add these files, then you have to set path of this file in your Xcode.
Step: Click on your project -> Target project ->Build setting ->now search for Header Search Path.
In Header Search path , you have to set the path of these two file respectively.
thank you.

FMDB not working in swift?

In my project I added FMDB using cocoapods. I then created a bridging header for FMDB. But when I import FMDB.h using #import "FMDB.h" I receive the error "FMDB.h not found".
When I import "#import " from folder, Xcode again gives me errors for importing inside FMDB framework files: "Include of non-modular header inside framework module (module name)"
What is the problem?
I had the same problem and found that none of the FM...h files were even in the folder being used by the code. Once I put them there, it worked.
If you highlight the FMDB.h file in the project navigator, you will see the path being searched for the files in the upper right corner of the screen under "Identity and Type" called "Full Path". If you check that physical location, you will likely find that the files are not there to be found.
enter image description here
Try going to the Build Settings tab under the "Target" and set Allow Non-modular Includes in Framework Modules to YES.
If that doesn't work, try selecting the FMDB.h file in the project navigator. In the target membership area on the right there is a drop down menu next to the target. Select "Public" there. It may be set to "Project" right now.
Hope that helps!

Problems when adding an external framework in iOS

I want to add the PLCrashFramework in my app. This frameworks deals with crash reporting for iOS/MAC applications. What I did
Downloaded and unzipped the .zip file from the URL I have already provided.
In Xcode "Build Phases" -> Link Binary With Libraries
From the pop up "Choose frameworks and libraries to add"
Select "Add Other"... and select "CrashReporter.framework" and Open
After those steps I successfully built the project without problems.
I closed the Xcode, opened it again and tried to build. The build failed with
"header file not found", referring to a header file that belongs to the framework.
Why the xcode 6 does not find the header after closing and reopening the project?
Check your Framework Search Paths and Library Search Paths in your project's Build Settings. Check if you have a space in your directory structure. It's probably looking for 2 folders, one with the first part of the folder structure and one with the second. To fix this, simply add quotes around the whole folder structure.
You should add the framework though add file in project navigator by right click and select add file in your project and than browse to framework location and add framework. Remember to check copy file in your project it is must do. In this way Xcode will manage library header search path. You can see the framework will be added in Xcode "Build Phases" -> Link Binary With Libraries. If it is somehow not there you can add it by dragging framework from project navigator. The error will be gone.

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

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.

Importing Framework in iOS5 Project

I have a project in Xcode that I need to use the AWS SDK in, and for whatever reason, I cannot get it to work. If I copy the AWS.framework folder into my project folder, and then drag it into the Xcode window under Frameworks, all of the files under the Headers folder are red.
If I drag the folder from another location and allow Xcode to copy the framework over, all the files are black in the list.
However, when I try and import the headers (#import <AWSiOSSDK/etc), it says it can't find the file, and the AWS SDK doesn't appear in the autocomplete when I'm typing out the import statement. Am I importing it right, or is there something else I'm doing wrong?
Go to target and click tab "Build Phases" and add your SDK into "link binary with libraries".. I didn't try add SDK files into my project. But try it. After you added that, clean your project and then try import files from your framework.

Resources