I have added the objection Framework to my project via linked binaries.
Now I am trying to import a file form this framework
#import <Objection/Objection.h>
But the compiler says: Objection/Objection.h not found!
I tried everything,
other linker flags are set to -ObjC and -all_load
Framework search Paths are set to the correct directory
The Library is linked within the project
So what else could be the problem?
Thanks for your help in advance!
When the Objection framework is built for iOS the framework is called 'Objection-iOS.framework'. Ergo the import would look something like this:
#import <Objection-iOS/Objection.h>
Did you add your framework like so ?
In the project navigator, select
your project
Select your target
Select the 'Build Phases' tab
Open 'Link Binaries With Libraries'
expander
Click the '+' button
Select your framework
(optional) Drag and drop the added
framework to the 'Frameworks' group
See Apple's documentation on this
If you have done exactly what I said above then I'm not sure if this is going to work, but I use another method to add frameworks, which is go to your project (The one with the xcodeproj icon), then click on your target. There, you can add the frameworks you want.
If that doesn't work, then try go to /Library/Frameworks to see if your framework you want is still there. If it's there and it's still getting that error, try manually adding the framework which is the add other button when you add a framework.
Related
I am developing an iOS Real Framework with XCode. This Framework (A) needs an external framework (B) to compile. For example:
A FRAMEWORK
+Frameworks
-B FRAMEWORK
It is imported in A by using:
#import<BFRAMEWORK/bframework.h>
I create the A.framework to be linked in a project.
The problem is when I link this A Framework in a project. The project returns "BFRAMEWORK/bframework.h" not found.
I want to include B framework in A.framework so not to need to add B framework also in my project. For example:
MY PROJECT
+Frameworks
-A.Framework (with B Framework included inside).
Do you know how to do this? or another way to do this?
Thank you!
I was able to create this structure with iOS-Universal-Framework: https://github.com/kstenerud/iOS-Universal-Framework.
I created a Static iOS Framework 'FrameworkB' with 1 method, which is imported in a second Static iOS Framework 'Framework A' with 1 method that's calling FrameworkB's method. I then created an iPad app which imports FrameworkA and calls the method. Code runs fine and prints from FrameworkA (which fetches from FrameworkB) and of course FrameworkB is not imported. Please note that all frameworks have to be built for the same profile (i used iPad), otherwise you'll get linker errors.
Maybe you add BFramework in compile sources?
Or add headers in header search paths?
or set dependency in build settings.
I think you are looking for OTHER_LDFLAGS = -ObjC
I'm running Xcode 4 and trying to follow the steps in Apple's Image Kit Programming Guide (which is written for Xcode 3) on how to work with an Image View and the IKImageView class. I just imported the Quartz and Quartz Core frameworks (from /System/Frameworks directory) to my blank Cocoa Application project using File > Add Files to... menu, but when I try to Run my application I get this error:
Lexical or Preprocessor Issue 'QuartzCore/CIColor.h' file not found
Does anyone know what could be a reason?
Peter Hosey replied:
You're not supposed to import specific headers directly, and especially not from sub-frameworks (such as Core Image, sub-framework of QuartzCore). Only import a framework's overall header, which usually has the same name as the framework.
I didn't import any specific headers directly, I just choose File>Add Files to... then choose /system/Frameworks and choose two folders which contain those frameworks, after that they appeared in my project navigator view as they should, but the code wouldn't compile any more. It shows me NSColor.h file which is found in the AppKit framework, points at this line: #import and says Lexical or Preprocessor Issue 'QuartzCore/CIColor.h' file not found. I have no clue why it wouldn't compile. CI stands for Core Image. I'm now reading a guide on Core Image, maybe this will help. I'd like to post a screenshot but I can't (not enough rights yet).
I just imported the Quartz and Quartz Core frameworks (from /System/Frameworks directory) to my blank Cocoa Application project using File > Add Files to... menu, …
That's not importing; that's just adding it to the project (and hopefully the target). Importing is what you do with the #import directive.
… but when I try to Run my application I get this error: Lexical or Preprocessor Issue 'QuartzCore/CIColor.h' file not found
You're not supposed to import specific headers directly, and especially not from sub-frameworks (such as Core Image, sub-framework of QuartzCore). Only import a framework's overall header, which usually has the same name as the framework.
The problem was that the Guide I used was written for Xcode 3 so when I tried to import/add some frameworks to my project using "File>Add files" menu as described, it did add those frameworks and I could see them in the project navigator, but something went wrong. In Xcode 4 you should use a different way to add/import Frameworks by using the Project Editor> Summary tab> Linked Frameworks and Libraries> Click "+" and then choose the Frameworks you need. That fixed the issue.
Here is what I did:
In Xcode 4.3.1
File -> New -> Project -> Single view application
Dragged the file cocos2d-ios.xcodeproj into navigator.
In build phases settings : Added : libcocos2d.a (becomes highlighted in red), as a linked library (required).
Added OpenGles.framework, Quartzcore, and libz.dylib
Changed build settings - Set "Always Search User Paths" to YES
Added cocos2d source directory to "User Header Search Paths"
Now, it seems I can type: import "cocos2d.h" , in the app delegate and root view controller that Xcode created. But if I create a new file, and I add the line "import "cocos2d.h"" to the top, Xcode complains that the file is not found. But it seems to build fine. Also, in this new file code sense does not work.
What should I do? Why can I import only in the files that Xcode created? Is there some setting I need to change so that in the files I create, I can import cocos2d ?
EDIT: It seems to build and run fine. I can call methods in the cocos2d api. code sense just doesn't seem to see cocos2d.h in the new files I create.
EDIT - it seems that code sense suggests cocos2d.h when i type : import "
But it does not suggest classes / methods from the cocos2d api.
Turns out I had only added the "user header search paths" to my target, but not in the project settings.
Adding it fixed the problem. I guess the reason it compiled fine was because I had added it to the target, but it didn't work in the text editor since I hadn't added it to the project.
This happened to me as well, even though I did add it to both project and target.
However, what worked for me was to select the RECURSIVE checkbox under "User Header Search Prefixes" (which was set to "/lib/**")
I had same issue.
My project -> Build Settings
Look for the entry for Search Paths
Always Search User Paths - YES
User Header Search paths - "myProjectName/libs" //I put box2d folder here
Hope this help someone.
I have an existing framework (MyFramework) and I've added a new class to it, NewClass. In another project I am already using this framework and I now want to use NewClass as well. I use the following import statements:
#import <MyFramework/OldClass.h>
#import <MyFramework/NewClass.h>
When I compile the project, I get an error on the second import that says "MyFramework/NewClass.h: No such file or directory". NewClass.h is in the exact same location as OldClass.h, the framework compiles with no errors, I've made sure to clean out any old artifacts, and I've verified that in the framework's target I've included NewClass.h in the "Copy Headers" build phase.
What additional step is required to make a framework's header files available to users of the framework?
p.s. I realize that I should likely have a single MyFramework.h for anyone wanting to use the framework, but I'll tackle that once I've figured out how to add new headers!
Set role of the header to Public.
In Xcode 3 right click on the header, select Set Role from the menu.
In Xcode 4 select your target, open Build Phases and change the section of your header in the Copy Headers section from Project to Public.
Update:
In Xcode 4.5 select the header, open the File Inspector in the Utilities panel on the right, change the role to Public in the Target Membership section.
I am trying to study OpenGL and I have the framework added, but I am getting linker errors. I believe the issue is adding the library to the project for linking and EVERY time I try to add a library, I hunt around for the configuration setting forever. Someone, please give me the simple click-n-go answer!
The linker cannot find the CAEAGLLayer framework to link against.
Add the QuartzCore.framework and the linker will be able to find the missing framework.
To do this right-click on the Frameworks the choose:
Add > Existing Frameworks > QuartzCore.framework.
alt text http://img19.imageshack.us/img19/223/screenshot20091206at544.png