Unable to find headers in static library - ios

I'd like to add DTCoreText to my project. I followed the instructions (starting at the DTCoreTExt GitHub page) to setup the project using CocoaPods. Finally I've created a "libPod.a" library file.
I've added the library file to my project (by copying the file in to a project sub-folder and added the file to the "Linked Frameworks and Libraries".
Finally I've tried to run the "Smoke test" as defined in the "DTCoreText Programming Guide".
Without success. XCode can't find the DTCoreText.h file (or any other file of this lib).
Have I missed something? Please help! :o)

Did you check the Header Search Paths in the Build Settings to ensure the path is correct?

Thanks to #Michael and #eharo2, you pointed into the right direction.
I wasn't aware that it's necessary to copy ALL header files together with the library file.
Btw. the relevant path is defined in the Build Settings under Search Paths in Library Search Paths

Related

Xcode not searching correct subdirectory for headers

I am using Cocoapods for dependency resolution in an iOS project.
The problem I am having is that the compiler is unable to find the correct subdirectory where the headers are located.
See in the image below the directory in which the compiler is searching for the header file:
However, the file is in the subdirectory /Users/Scott/Documents/GitHub/ios-demo/Pods/iOS-KML-Framework/KML. How do I specifically enable that subdirectory to be searched? I have tried suggestions here and here but those did not seem to work.
Any help would be greatly appreciated!
try set Header Search Path or Library Search Path in Building Setting:

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.

Integrating UrbanAirShip - Header search paths with relative path

I'm trying to integrate UrbanAirShip in my application following these steps .
This is what i've done:
1) I've Unziped the framework in the Project folder so that I have the Airship folder at the same level of other file of my project.
2) I've added the path ./Airship/** to my Header search Paths.
I've also tried with ../Airship/** but it doesn't work.
3) I try to include the right headers
#import "UAirship.h"
#import "UAConfig.h"
#import "UAPush.h"
But xcode complains... saying 'UAirship.h' file not found.
What I'm doing wrong? Have I to include the files into the project?
Neither ./ or ../ worked for me in the Header Search Paths. I ended up using this:
$(PROJECT_DIR)/Airship
Airship folder is in same level as the project.
You mistyped the path to add in the Header Search Paths (forgot one ".") :
./Airship/**
Should be :
../Airship/**
Did you do the following step:
Link against the static library.
Add the libUAirship.a file to the “Link Binary With Libraries” section in the Build Phases tab for your target.
May not be applicable all of two years later, but I encountered a very similar problem today and solved it by using the CocoaPods version of the framework found here:
https://cocoapods.org/pods/UrbanAirship-iOS-SDK
After running pod install, I added the following paths to my Header Search Paths under target project > build settings:
It seemed redundant to me to add both paths, but without the subfolders at /** the AirshipLib.h file wasn't able to locate its dependancies, and without the main folder my Bridging-Header.h file wasn't able to locate AirshipLib.h
Luckily enough I'm using some old Objective-C files from our codebase and incorporating them into a new Swift app, so I already had a Bridging-Header.h file, but if you needed to create one you can find instructions here:
https://developer.apple.com/library/ios/documentation/Swift/Conceptual/BuildingCocoaApps/MixandMatch.html
Finally, I added the following to my Bridging-Header.h file:
#import "AirshipLib.h"
No issues on build and everything from the framework can be easily referenced directly in my files.

MapBox iOS SDK within your own Xcode

I downloaded MapBox example from github using the following
git clone --recursive https://github.com/mapbox/mapbox-ios-example.git
Which downloaded it including all dependencies. Now I'm trying to create a separate project and include MapBox DSK as it was in that example. I tried creating workspace then creating a single view project then add new file and select .xcodepro for the MapBox DSK but didn't work when I tried importing MapBox.h file. I never tried importing 3rd parties API before and a bit not sure how I can do that correctly. Any Idea how I can accomplish that ?
Thanks in Advance
Just try:
#import <Mapbox/Mapbox.h>
instead of just importing Mapbox.h as suggested here:
https://www.mapbox.com/blog/ios-sdk-framework
You simply drag the Mapbox-ios-sdk project file from Finder to the files pane in Xcode.
And then click the project in Xcode files pane, Target-->Build Settings. Search for "User Header Search Paths". Specify where the MapBox sdk is located.
What I do is I put the MapBox-iOS-sdk in my project directory. And I set the path as $(SRCROOT) and make sure to set it as recursive.
While you're at it also make sure -ObjC and -all_load are set in Other linker flags.
That only helps you reference the .h files, to link, also under Build Setting, Link Binary with Libraries you need libMapBox.a.
If there is a MapBox.bundle (as in the latest development branch) in the group and files pane, you want to drag that into Target->Build phases->Copy bundle resources as well. (The add button doesn't work for me.)
I think the best way is to look at mapbox-ios-example provided by MapBox and try to replicate all dependencies into your own project.
A bit late but I did it like it was explained here: http://mapbox.com/mapbox-ios-sdk/#binary.
Not messing around with git, just dragging things into your project, easy!
I think problem here is he couldn't find a specific 'file' that was titled "MapBox.Framework" inside the folder of resources downloaded from Map Box, however what you actually need to do is copy that whole folder, which is titled "MapBox.Framework" into the frameworks section. I think the confusion was that the main folder that needs to be copied doesn't look like the yellow framework icon until you copy that folder into Xcode's frameworks section.

Xcode - "no such file or directory" for headers

I'm hoping that somebody with some experience of iOS development can help with this issue.
I'm working with PhoneGap and ZXing. I've followed the enclosed readme, as well as these instructions: http://yannickloriot.com/2011/04/how-to-install-zxing-in-xcode-4/
PhoneGap plugin: https://github.com/phonegap/phonegap-plugins/tree/master/iPhone/BarcodeScanner
It seems many others have experienced this problem. When I compile, I get these errors:
ZXingWidgetController.h: No such file or directory
QRCodeReader.h: No such file or directory
In my project -> Build Settings -> Header Search Paths, I have defined:
$(SRCROOT)/zxing/cpp/core/src/
$(SRCROOT)/zxing/iphone/ZXingWidget/Classes (recursive)
I have checked the locations of those folders, and they match what is defined in the header search paths. In the plugins folder, the file "BarcodeScanner.h" has these lines, where the errors are being produced:
#import "ZXingWidgetController.h"
#import "QRCodeReader.h"
Any ideas? I've scoured the Internet and tried just about everything. I'm just about to go insane.
It sounds like it's an old project.
I'd create a new project. The header search paths shouldn't be needed.
Then add all the files in the original project to the new one. (Of course, there may be a few subtleties that being familiar with iOS would make easier.)

Resources