library linked but Xcode says "file not found." - ios

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.

Related

iOS : Could not build module <framework-name>

I've got Library from another team. I'm trying to use library in our project and while do so getting an error Could not build module 'Common Library' (name of framework)
Below are solutions that I worked on but didn't helped :
1. Delete Derived data content. Clean and Build.
2. Framework is added in 'Link binary with libraries' of Build phases.
3. While adding framework checkmarked : Target and Copy content to folder.
Even I tried this stackoverflow-link but didn't got any break-through!
The only thing that worked was deleting Objective-C bridging header path in Swift compiler - code generation section of build settings in Project.
However, thereafter I'm not able to get Common interface to create instance (i.e. Common dosen't appears in drop-down list)
Below is framework structure.
Any other fix?
you can try delete DerivedData dir.
where is DerivedData?(xcode 8)
go to File > workspace Settings, you'll see DerivedData path.
DerivedData path in xcode 8
Check whether the framework you are integrating is supporting your project architecture.
To see the framework supported architecture, use Terminal and navigate to Framework folder.
use, "lipo -info myFramework.framework/MyFramework"
And, if you want to use the framework files in your project, check whether the files are available in Framework/Headers Folder.
Getting this error :
Try, "file myFramework.framework/MyFramework" in Terminal
I think you does not need to compile CommonLibrary.framework again. So you can try to remove it from Embedded Binaries list. And make sure the path of CommonLibrary.framework is in your Framework Search Paths.
I also had this problem:
1. My 'GoodLuck' framework had two headers: GoodLuck.h and GLAdder.h
2. Project which import this framework couldn't compile
Solution:
Import GLAdder.h in GoodLuck.h, rebuild the framework. It works.
I also had this problem, due to a typo in my GCC_PREPROCESSOR_DEFINITIONS, which therefore invalidated all of my code.
First helpful warning was multiple "Macro Name must be an identifier" followed by multiple "Could not build module" messages.
As this question do not have answer yet, so adding my answer here it may help in future for some another developer.
I know due to privacy you can not disclose the details.
I have used same library and faced same issue so just did did this two things it is working fine.
In General -> Frameworks,Libraries -> CommonLibrary.framework just select that and choose -> Embed Without Signing.
Build Settings -> Search for "workspace" -> Validate workspace -> set it NO
That's it you are done.

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.

external framework File/File.h (Parse/Parse.h) file not found

So every time I update my app, Xcode claims not to be able to find a particular external framework even though it's there. It's happened again with Xcode 6 and my usual methods (I'm fairly inexperienced, so these basically involve clicking and typing things until something happens (I exaggerate but not by much)) aren't working.
I'm getting a Lexical or Preprocessor Issue error that says 'Parse/Parse.h' file not found.' But here are screenshots of it in the project and added to the library:
I also followed the steps in the most upvoted answer at ‘ld: warning: directory not found for option’ but still nothing.
Any idea what to do? Any idea at all? I'm tearing my hair out here.
Actually I was facing the same problem but after doing lots of (removing/adding parse framework) efforts I come to know that parse.framework is already added and error was still there.
Real Problem was not in link Binary for main project but it was with Tests link Binary.
Lets say your project name is "project1" and Xcode create one more folder with it called "project1Tests". So select "project1Tests" and add parse.framework in link Binary.
Check out the hierarchy:
PROJECT
project1
TARGETS
project1
project1Tests (you need to select this to add parse framework).
Hope this would help you resolve this issue.
I had this error also. I'm developing in Swift, so I added a "bridge header" as described in this Parse blog post.
The reason I got the "Parse.h not found" was that my project name contained spaces. (For project name I mean the Product Name you enter when creating a new project, which determines your folder's name.) The first day all went well, but after closing and opening Xcode, it turns out that Xcode interprets the words separated by spaces as different paths.
To fix this, you can go to Build Settings -> Search Paths -> Framework Search Paths and add an "\" before each space. (If you double click the path you'll see that Xcode shows each word separated by space as a different entry.)
Also note that the bridge header with #import <Parse/Parse.h> it's not compulsory: you can simply do import Parse.
All I had to do was remove Parse.framework from this list by highlighting and pressing delete.
Then I went down to the plus sign at the bottom of that list and had to select Add Other and manually locate the downloaded .framework file.
In my case, the error went away after I added the path to the directory where Parse.framework was to the Frameworks Search Paths Build Setting:
My project didn't even have an entry for that setting, so you may need to create it as well.
I had the same issue when upgrading parse to 1.4v. You have to delete Parse.framework from Framework List and from the project directory, when removed from both places copy again and check "Copy items to destination's group folder". It worked for me.
Its work for me.
Just go to Build Active Architecture Only and Debug should be yes and Release should be No
In my case I had to do one more thing additional to Sukhchais' answer.
It seems that though the parse.framework appears in the 'link Binary with Libraries' list for the targets, they might not have linked properly for some reason. Just remove parse.framework from the list and add it again as mentioned. By that way I was able to resolve my issue.
Just to Share my findings in case if somebody might have the same issue:
Accidentally we had two references of Parse.framework inside our source code base at two different places. And a reference of Parse.framework was linked in Build Phases of the target, from the first place. But when the app is compiled, Xcode was not smart enough to get a reference and trowed an error: "Lexical or Preprocessor Issue" error when "Parse/Parse.h" is imported in .pch file.
After spending couple of hours by trying various options, removed a reference of Parse.framework from the source base and kept only a single reference. This solved the issue.
And the app compiled successfully :)
For people coming from Ionic + Cordova if you are getting this error I solved it by removing my current parsePlugin and replacing it with this fork.
For simplicity, I used these console commands (Replace PARSE_APP_ID and PARSE_CLIENT_KEY with your keys in the Parse Console):
cordova plugin rm com.parse.cordova.core.pushPlugin
cordova plugin add https://github.com/grrrian/phonegap-parse-plugin --variable APP_ID=PARSE_APP_ID --variable CLIENT_KEY=PARSE_CLIENT_KEY
Ok, so I was having this problem as well. I uninstalled all my pods, reinstalled them again, and had no luck.
So the good news (and bad news considering the time I spent trying to find the problem) is that I eventually managed to solve it. Apparently, you have to import Foundation/Foundation.h before parse. I don't know whether this will work for you or not, but I tried everything on the net, and only this seemed to work. If you have any instances of this:
#import <Parse/Parse.h>
#import <Foundation/Foundation.h>
flip it around so that Foundation is declared first:
#import <Foundation/Foundation.h>
#import <Parse/Parse.h>
I also read somewhere that some people had issues with Facebook SDK and Parse SDK import. Apparently, the two have Bolt.Framework in common or something, which causes error. I removed Facebook SDK as well, which at first didn't make any difference. I hope I could help.

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.

Xcode file not found

I am facing an error of file not found.
I have added all necessary files, but it gives file not found for a file.
#import "MagickWand.h"
for above file it gives error.
#import "FrameSection.h"
#import "FreeCropIphone5.h"
#import "DoodleView.h"
Please help me.
Clean the build folder by pressing ⌘ + ⇧ + k. It may help you to rectify the error caused.
There can be many cases that cause this error. This is one of the option to clear that error.
NOTE
As According to this kind of problem the reason may be sometime due to cyclic import. means like you have a file with the name first.h and you importing second.h and in second.h you importing first.h and you not including first.h.
Try these steps hope this will help you.
target of project -> Build Phases -> Compile Sources ->
delete the [found filename that cause the error in program].m
Add it back again in you project.
Clean Your iOS project And then Build Again.
I dragged folder in XCode, it started appearing blue and files in that folder wasn't accessible in Project anywhere although they does exists in blue folder.
Solution:
I simply deleted that folder reference from project, created "New Group" and added files in it, its started working correctly.
I was facing this error after a merge from the repository (git). The final solution was:
Delete the files from the xcode project navigator (only deleting references).
Add them again to the project (dragging from finder into the project navigator).
Hope it helps!
Check that your corresponding frameworks are included in your bundle.
For that, access to your project settings, select your target, and under Build Phases, check on the "Link binaries with libraries" section that your frameworks are here.
Use the search bar in the Target -> Build Phases window to make sure the missing file's .m is listed under the Compile Sources and the .h file is listed under the Copy Files. If it's not there, add it.
I was able to fix this problem by adding the missing .h file.

Resources