I am trying to incorporate the three20 library and Keith Lazuka's Kal (Calendar UI) library into my project. I have included the three20 static library and everything works fine.
Now when I try to add Kal into to my project using the instruction specified in here https://github.com/klazuka/Kal, Xcode is unable to find the header files and I get an error:
Kal.h:No such file or directory
However if I have a new project and I add the Kal library, it works fine. So do I have to do something special to include two static libraries in my xcode project?
You may still need to tell XCode where to find the header files for the kal.h library.
Go to Project->Edit Project Settings.
Select the "build" tab. Scroll down to the Search Paths.
**Double clicking User Header Search Paths brings a dialog box. NOTE: In Xcode 4 I found that you actually need to add the path to "Header Search Path" NOT "User Header Search Path"
Drag directories from Finder into the dialog box or click the + button to add manually.
** I've not really gotten the hang of xcode yet so Im putting the same search paths in Framework, Header and User Header. So far it's worked out fine, but I shall expect (and deserve) a scolding from the xcode savvy individuals for such behavior.
Related
I'am a newcomer to cocoa developement and i have not yet got used to.
When use eclipse for java development, we can see all the added jars source file if we attached the source files.
But in xcode, we add a framework such as "Cocoa.framework",there is only one Cocoa.h file we can see.
eg:
I clone the 'Sonora' source code from github for study.
there is one line
#import "SNRFileCopyManager.h"
exist in SNRFileImportOperation.h file
Both the SNRFileImportOperation.h and SNRFileCopyManager.h can be found in Sonora/Classes directory.
But, i can see the SNRFileImportOperation.h file in xcode project only and they get work fine together, Why this non third party header file not display in it's own project?
I know something about the dependency setting adn header search paths.
Any one give me a guidance or some references of the code management|organization?
Thanks a lot.
The file SNRFileCopyManager.h is found because it is in one of the include search paths. If you select a header file in Xcode and look at the info panel on the right side you can see that it doesn't actually belong to any target, they are shown more or less regardless. Though, building a framework you can select header files to be included into the framework when building. So, you can just pull in your header files into Xcode.
I'm trying to begin localization on a project, and I've already got an English version of Localizable.strings going. I'm now trying to add French to that file, which is creating an fr.lproj folder, as I'd expect. However, it's putting it in my project root, and I'd like it inside my project's Resources directory.
Xcode seems to have no interest in letting me move the file, and if I move it in Finder, it goes red in Xcode as expected, but doesn't let me click to locate the file.
I've tried moving it in Finder, then editing project.pbxproj in a text editor to add Resources/ in front of the only line in there that mentions fr.lproj/Localizable.strings, and that has worked, but after doing that, the project's targets also turned red in Xcode, and building the app doesn't change that fact. Very odd.. any idea what could be going on, or how to get this going?
This can be a real pain. I even had XCode crash on me when trying to correct unwanted file locations. I found that the best way is to create the localized file (be it .strings or .xib) as a copy of the source language version outside of XCode, then drag and drop it into XCode. If you do this then XCode will display it correctly and your targets' Build Phases > Copy Bundle Resources settings will include it with its correct location. I don't know why your targets are displayed in red, perhaps you could look under Copy Bundle Resources in case anything is wrong there, or also select your project and click Validate Settings in case you haven't already done so.
Also, if you have been testing in the simulator beware of how XCode does not clean up the files in your app bundle--you may want to delete the app and run it again to make sure it's working with your new location.
I have been exploring private APIs within iOS for the express purpose of experimentation. Does anyone have a sample of instantiating a class like MKTransitAnnotationView?
I've downloaded Erica Sadun's HeaderDumpKit and the class-dump binary. After making a few corrections to her perl script I dumped out a Headers directory and moved that into the project folder.
In the Other Linker Flags section of Build Settings I added:
-force_flat_namespace
-undefined suppress
When trying to call MKTransitAnnotationView I get dyld: Symbol not found: _OBJC_CLASS_$_MKTransitAnnotationView. So what have I missed?
Add your dumped header as a normal header file, then from your project navigator:
click on your project
click on your target
click on the Build Phases tab, then expand the Link Binary With Libraries section
drag/drop the binary from PrivateFramework folder that you want to use.
Then you should be all set.
Normally you shouldn't have to change your flags.
I'm trying to import the cocoalibspotify into my Xcode project. https://github.com/spotify/cocoalibspotify
However I am completly lost to what files need to be imported and how. I'm still a beginner and the sparse info on the spotify website doesn't really help me. I did manage to run the Simple Player sample project though and I tried looking at what files are imported. But I didn't get very far with this.
I tried importing the following files that come with the zip by dragging these into my project:
CocoaLibSpotify iOS Library.xcodeproj
CocoaLibSpotify iOS Library-Prefix.pch
SPLoginResources.bundle
CocoaLibSpotify iOS Test Container (folder)
View Controllers (folder)
after doing that however, my project simply won't compile anymore.
I'm getting all kinds of errors. I'm guessing these are related to setting the wrong target???
the website does mention a couple more instructions for iOS when you scroll down on the page https://github.com/spotify/cocoalibspotify
I did manage to import the frameworks but the other stuff is beyond me.
So if anyone is willing to guide me through this, that would be great!
EDIT:
I think I'm getting closer. I've created a ".a" file by opening the "CocoaLibSpotify iOS Library.xcodeproj " and making a build. then I import the resulting libCocoaLibSpotify.a file and also a folder called "include" which has a lot of header files.
You only need to include the CocoaLibSpotify iOS Library.xcodeproj file in your project.
Once you've done that, make sure CocoaLibSpotify is added in the "Target Dependencies" and "Link Binary with Libraries" build phases of your project by clicking the '+' button in each of those phases and choosing it from the list.
Other than that, make sure you closely follow the instructions in the "Building - iOS" section of CocoaLibSpotify's README.markdown file and you'll be set.
I have created a sample application to perform bump distortion, using the GPUImage framework. I added this framework to my application, but I'm seeing the following error
Lexical or preprocessor issue 'GPUImage.h' file not found.
I have added the -ObjC flag to the Other Linker Flags, but I'm still seeing this error. How can I solve this problem and get my application to compile?
Adding GPUImage framework to XCode project could be tricky. So I haved added detailed step-by-step instructions w/ images on how to do it.
Static Compilation Method (detailed solution so we don't mess up)
This is Static compilation method. In this basically we will compile the framework using ./build.sh file. And simply add it to our XCode project, then configure XCode to properly use it.
Download GPUImage from Github and extract it (or just clone it).
Go to the GPUImagefolder in terminal
Run ./build.sh
Note: This will compile and create ready-to-use binary for all the sdks on your mac.
build.sh creates a folder called build and generates compiled binaries and dumps them to folders like: Release-iPhone, Release-iPhoneOS, Release-iphonesimulator etc folders.
For iPhone use Release-iphone (This also works for simulator).
Copy (not drag-drop) Release-iphone to your XCode project's root directory so that we have a local copy of framework.
Now iPhone drag-and-drop Release-iphone onto your XCode project. Make sure to check "Copy to .." option.
Note:
This Release-iphone folder contains two sub-folders: include and lib
include folder contains all the header .h files
lib folder contains compiled binary version file called libGPUImage.a
We now need to simply configure XCode to use .h and .a files.**
Select your project in the project explorer > Project name under Targets > select Build Phases > Expand Link Binary With Libraries
Add the libGPUImage.a to Link Binary With Libraries section. You may want to Right-click on libGPUImage.a then Open in Finder and finally drag-drop it.
While we are at it, also add the following GPUImage's dependent frameworks/ libraries
CoreMedia, CoreVideo, OpenGLES, AVFoundation, QuartzCore to Link Binary With Libraries section
Now, lets configure .h headers.
Select your project in the project explorer > Project name under Targets > select Build Settings > and type search paths to see search paths section.
Open Headers Search Paths by clicking on the value field.
Drag-and-drop the lib folder to that popup. Note: If it shows absolute path, change it to looks $(SRCROOT)/path/to/lib/. (You should have the framework relative to your xcode project see step 6).
Repeat 11 & 12 for Library Search Paths as well.
Additional tips: You can add .h files to Library Search Paths or Headers Search Paths, you can make them Recursive. I have a main root-folder called Dependencies folder where I keep all the dependencies like MySDK-framework including Release-iPhone. And I just have one search-path at the Dependencies (root folder) and made it recursive.
Did you follow all of the instructions from the Readme on the project page? From the installation instructions:
You'll also need to find the framework headers, so within your
project's build settings set the Header Search Paths to the relative
path from your application to the framework/ subdirectory within the
GPUImage source directory. Make this header search path recursive.
If you're seeing the above error, it means that you did not point the Header Search Paths at the right directory where you've installed GPUImage relative to your project, and / or did not click the checkbox to the left to make those search paths recursive.
I show some screenshots of where you need to go to set this in this answer, which explains something similar for the Core Plot framework. The same principles apply, only you need to find where you installed the GPUImage framework at.
I add relative path to "Header Search Paths", but there is still a error that is "not found".
Then, I add path to "User Header Search Paths", and it works.
May help you.
finally, I realized the KEY WORD is relativeļ¼
I put GPUImage source files in my project root dir:
before I solved the problem, I add Header Search Paths is:
$(PROJECT_DIR)/GPUImage/framework
$(PROJECT_DIR)/GPUImage/framework/iOS
and make them Recursive, but error is still there, So I changed Paths to:
GPUImage/framework and make it Recursive, then it works.
Hope it helps.