XCode - iOS - <OCMock/OCMock.h> file not found - ios

I Have an iOS application that I am trying to add OCMock to in order to better unit test it. I've followed the instruction on ocmock.org as well as instructions I've found in other places but still I cannot get my test code to compile.
Here's what I've done
Added the source code to my project directory
Create the groups in my project to mimic my file system
I selected the option to add to my test targets so the framework was added appropriately as well as the Library Search Path
Then I manually added the headers to the Header Search Path
And added the -ObjC linker flag
Then when I go to import the header file, I get the file not found error
Any ideas what I am missing here???

You have the search path test/libraries/OCMock. Then you have #import <OCMock/OCMock.h>.
This fails because there is no file test/libraries/OCMock/OCMock/OCMock.h.
You use the search path test/libraries, or you can create a prefix directory to hold OCMock and have the search path point at that.
I generally have a directory with the library name and version number before the actually directory.
The directory test/libraries/OCMock-X.X.X could contain the OCMock directory. That way the search path still be more specific: test/libraries/OCMock-X.X.X and you still use OCMock/OCMock.h as the include.

One more thing to check, for anyone else having this problem - I copied OCMock from one project to another and everything looked right, but it wasn't finding the include file. It turned out that even though I had the right groups in Xcode, the files had all been dumped into one directory. I needed to create folders on disk and associate them with the groups in Xcode. The accepted answer here clued me in to what was wrong (though as is often the case, in hindsight it should have been obvious).

Related

Generated header file not found in xcode

We are working on a swift project where we use a little bit of Objc.
I have two targets and one framework with a big part of the code (also the mixed code) inside it. My two targets including this framework. (screenshot)
Now I keep getting this error.
'Nexx4-iOS-Swift.h' file not found
Nexx4-iOS is the generated header file that is been created. When I look inside derived data I will find this file. But I cannot navigate (CMD-click) to the file. So it seems that that there is some thing wrong with the linking of it?
Any help?
First remove is header file path from the Build Setting in Project in each target.
And again recreate header file.
Go to Build Settings under Packaging, search for Defines Module and set it to Yes. Hope this may helpful.

Importing a library in to an Xcode 7 project

So I am trying to add a static library to my project in order to interface with a scanner. I have linked the binary in build phases to the libCaptuvoSDK.a, put the Captuvo.h header file in the project folder, and finally set the project to always search the user paths and added $(BUILT_PRODUCTS_DIR) recursive to the user header search paths. After doing all this I am trying to use #import "Captuvo.h" in my ViewController.swift file and getting the 2 errors Expected identifier in import declaration, and Expected expression. I have tried different combinations of importing and none of them seem to make a difference so I am led to believe the issue is with my process of adding the library.
I am new to Xcode and have never used a third party library in an application before so I feel I may be making a simple mistake or just misinterpreting things. Any help is appreciated!
Okay so I managed to fix my issue! I had imported the static library properly but the real issue was the header file. I fixed my issue by creating a new file in my projects folder named Quick-Scan-Bridging-Header.h. Inside that file is where the #import "Captuvo.h" line belonged. Once that was done I opened the Quick Scan apps build settings and under Objective-C Bridging Header I added the path Quick Scan/Quick-Scan-Bridging-Header. I also added the Header Search Path $(BUILT_PRODUCTS_DIR)
After I did all this I am able to use the Captuvo classes in my ViewController.swift file.

'File/File.h' (Parse/Parse.h) not found on Archive / Profile with Xcode 5

I'm using an external framework (Parse) in my project. Everything runs smoothly when running, testing and analyzing, but archiving and profiling both throw:
Lexical or Preprocesor Issue: 'Parse.Parse.h' file not found
I've remedied issues with other static library/framework .headers not being found during archive in the past by altering the Header Search Paths and User Header Search Paths, but that plan of attack just isn't working here. Namely, I've included
$(BUILD_ROOT)/../IntermediateBuildFilesPath/UninstalledProducts/include"
$(PROJECT_TEMP_DIR)/../UninstalledProducts/include"
$(BUILT_PRODUCTS_DIR)
in the Header Search Paths and User Header Search Paths for Build + Release with no result. (I know that's redundant, especially since I've set Always Search User Paths to YES, but I'm trying everything here.) I've tried adding the .h file directly to Copy Bundle Resources in a last ditch effort. Also tried removing and re-adding the framework, cleaning, etc but I've had no luck. Any thoughts much appreciated!
Verify you have
import "Parse/Parse.h"
in your header file.
Try to do a product->Analyze.
Make sure you have added parse.framework and it has all these header files:

cant import NYXImagesKit library

I am trying to import the NYXImagesKit library in to my iOS 5.1 project but it will not show up as importable code. It cannot find the library. I have dragged the NYXImagesKit library in to the project and added the libraries. I have also added the following to my build phases:
However I still get an error saying it cannot find NYXImagesKit.h when i try to import it.
NYXImagesKit can be found from here: https://github.com/Nyx0uf/NYXImagesKit
Ive used this in a previous project so I know that it works.
screenshot of location of .h file:
header search paths:
You are not having an issue with "importing" the library proper. (I would not like to appear pedantic, but a library is linked, not imported). The issue you are having is with the header file which comes with the library.
To fix it, you should make sure to add the path to NYXImagesKit.h in your project build sentting (Search Headers Path). This can by found under Build options in your project settings.
Alternatively, an easier way is to add the NYXImagesKit.h file to your project (like any .m file). Then it will be found without the need to specify an header search path.
EDIT:
Since from what you report, everything seems ok, he only idea I can come up with is making sure that the paths are defined for your target (as opposed to the project overall); but I guess it is already like that.
Other than that, only resort is thinking that the project got corrupted somehow. You can inspect the project.pbxproj file inside your .xcodeproj document with a text editor and ensure that everything looks fine.
If everything fails, just start over with a new project.

iOS,CoreAudio: a strange 'CADebugPrintf.h: no such file or directory ... ' error

There are bunch of helper filess in 'iPublicUtility' folder of several audio related Apple sample codes, such as aurioTouch:
http://developer.apple.com/library/ios/#samplecode/aurioTouch/Introduction/Intro.html
I can build these samples fine. But whenever I create a new project for testing and include the files from 'iPublicUtility' folder, I get:
'CADebugPrintf.h: no such file or directory ... ' error in 'CADebugMacros.h' file.
I made the settings of my test project to coincide with Apple samples, but this error is
not going away. Any suggestion?
SDK: iOS 4.2,
iMac OSX 10.6.6
Thanks all.
sy
select the Target, open the Build Settings pane, search for "Preprocessor Macros". Leave the fields blank (I've got rid of a DEBUG entry)
I used the answer provided by Justin and it worked fine, until I installed Xcode 4.3.1 and the problem came back.
Currently I solved this by downloading CADebugPrintf.h and .cpp.
I found the 2 files at this link:
http://svn.perian.org/trunk/CoreAudio/PublicUtility/
Cheers.
i have three distributions of Xcode installed.
the file exists in all three.
1) verify that the file exists on your system.
2a) add a search path to your project for the PublicUtility directory
or
2b) add the header to the target's "copy headers" build phase
depending on how many depends you have for these files, you may want a more reliable approach (which exists). one (fairly) safe/easy way to do this if you use a lot of the audio technologies and sources is to add its parent dir's parent dir to your search paths or source trees (recursively).
another way is to add it to a shared build settings file.
you could also copy a specific release someplace, then add that to your search paths. just be aware that the sources get updated somewhat regularly, so you'll have to update it when it's a good time for you. in this case, you'll should change your project references as well.
Edit: Adding the search path (2a)
One way to add a search path (assuming Xcode tools are installed at : /Developer/):
1) In Xcode (3), select the target.
2) cmd+i (get info)
3) select the "Build" tab of the info window
4) enter HEADER_SEARCH_PATHS into the search field
5) if the value is not defined at this level (e.g., it is not bold), then set the value to /Developer/Extras/CoreAudio/PublicUtility/ $(inherited)
if it is already defined at that level, then add /Developer/Extras/CoreAudio/PublicUtility/ to the list of directories to search (the value).
if you want to search the library recursively, use /Developer/Extras/CoreAudio/**. this may be useful when building AUs, or other projects which require the AU includes and PublicUtility includes.
Same problem, but seemed to have fixed it by downloading from the link below and adding in the missing CADebugPrintf.h and CADebugPrintf.cpp files.
https://developer.apple.com/library/ios/samplecode/CoreAudioUtilityClasses/Listings/CoreAudio_PublicUtility_CADebugPrintf_h.html
I was having the same problem and downloading the files into the iPublicUtility folder did not solve it. I found the answer by accident while learning about .mm extension files on this page:
Objective C Project using C++ POSIX Classes
I renamed my implementation file with a .mm and the compiler errors disappeared. Hope this may help someone down the line!

Resources