Can't Find Framework .h File - objective-c

I downloaded Andy Potion's "PFLetsMove" framework here and added the Xcode Project to my application's project. I then dragged the framework from that to the Link Binary with Libraries and Copy Files build phases.
Now, if I compile the application with a call to PFMoveToApplicationsFolderIfNecessary() it works fine, so the framework is definitely there. But if I put the line #import "PFLetsMove/PFMoveApplication.h" in the app delegate, I get the following error: 'PFLetsMove/PFMoveApplication.h' file not found.
I've checked the compiled PFLetsMove.framework in the build folder, and PFMoveApplication.h is there. I did the exact same thing with the AquaticPrime framework (import the header) and it works fine. Where am I going wrong here, or is there potentially an issue with how the framework is built?

If you use a framework, you put the file name in angle brackets (i.e. <FrameworkName/FileName.h>), if it's a local file, you use quotes (i.e. "FileName.h"). Note that even if the source file is in a group or subfolder, it is not referenced as such.

Related

How do I include Scintilla in an XCode 3.2.5 project?

I downloaded Scintilla, built and ran ScintillaTest. That worked (almost) fine. Now, I want to include Scintilla in a new project, but can't seem to figure out how to. I tried ctrl-clicking my target and selecting Add Existing Framework..., then Add Other... and finally file located at scite337/scintilla/cocoa/ScintillaFramework/build/Release/Scintilla.framework (obviously I omitted the first part of the path).
After I did this I just added an #import statement in the AppDelegate of my further untouched new project. Upon hitting Cmd+R it says ScintillaView.h: no such file or directory...
I thought that if I added the framework to my only target it would pass the location of the header files to the compiler (and preprocessor). Obviously it doesn't, so I assume I'll have to add the paths of the header files (and maybe other files) to the Build Settings, but there are lots of Build Settings, so I don't have a clue where.
If you don't have access to XCode 3.2.x, please leave how you'd do it in a newer version. I've found a lot of information on other XCode matters for higher versions did that work well in XCode 3.2.5 too (with a little bit of searching for menu items and settings panels).
By looking at the ScintillaTest XCode project I discovered how it works: you have to import the XCode project called ScintillaFramework, which is the file named ScintillaFramework.xcodeproj (obviously). But that isn't enough, after that XCode still can't find the header files in the framework. I looked at the build settings in the ScintillaTest project and found 'Header Search Paths' set to ../../. Setting this failed in my project, it had to be one directory less back: ../. No I just need to get the compiler to accept the C++ constructs in the Scintilla framework.
Update:
Strangely, this stopped working. I do not understand it either. So I just right-clicked my target, from there: add existing framework...->add other...->[browse to ScintillaFramework/build/Release/Scintilla.framework]. This works partially, see my newest question.

106 duplicate symbols for architecture armv7

Working on my iPhone app and trying to build for debug and I get "106 duplicate symbols for architecture armv7"?
I am using the .workspace file because I am trying to use CocoaPods. If I don't use the .workspace and instead use the .xcodeproj I don't get the error, but then I get missing -lPods .
In my project I have the following targets in the Project Navigator.
Pods (blue icon)
MyProject (blue icon)
Restkit.xcodeproj (blue icon)
... all my files
The issue is that Restkit is making reference to "AFHTTPClient.h" and all the other AF code, but I included it via CocoaPods. I tried deleting the AFNetworking folder from the RestKit library, but apparently the Restkit library can't find the Pods version of AFNetworking?
Is there a way to get RestKit to use the Pods version? If not how do I go about removing Pods from my project?
There is a line in one of your .h files where your wrote
#include "___.m"
instead of
#include "___.h"
So I fixed it. After removing the RestKit version of AFNetworking, from the vendor folder, I added it back by dragging into Xcode. It asks which project I want it used/copied to and this time I selected RestKitTest (or whatever the RestKitTesting is named). It works now. Maybe I selected both RestKit and RestKitTest before, which was wrong?
I also came up with same error. Generally this kind of error occurs due to duplicate classes and xibs in project folder. For Example in my project I had these classes twice ServiceRequest.h/.m. Get rid of duplicate ones and you are good to go.
In Build Phases -> Compile Sources, make sure you don't have the same file added twice.
"Duplicate symbols for architecture" issue occurs in two situations:
You added a .m file twice into your project
You're using a static library (.a file) which already includes some classes that you include into the project.
For fixing any of those cases, check the linker error and look for the .o files that are duplicated (sample: Reachability.o).
Then go to the build phases -> compile sources and search the specified files, if any one appears twice delete one of them, if only appears once it means that the file is also included in one of the static libraries added to your project. Delete it from your list of sources to be compiled and try again.
I saw this error when, I did drag and drop my calabash framework onto xcode and selected add to targets option in the window thats shown. Basically there were two references to files added
I had to remove the calabash framework manually
Right way of doing it
copy to calabash framework to project directory
then go to xcode project
Choose target -> Build phases -> Link Binary With Libraries and add the frame work using + button
I have noticed that duplicate symbols are caused for Google analytics after installing cocoaPods as well. Once I removed one of archives, either libGoogleAnalytics_debug.a or libGoogleAnalytics.a duplication has gone. But obviously if I removed debug one I will not be able to run os simulator and vica versa. I know its not the solution, but at least it could give an idea what could be a solution. Will come back to this thread if I will figure out how to have both a files in this case.
Edit:
I was able to solve the issue by upgrading from G analytics version 2 to 3. It has only one library file and I guess this is the reason why we don't get duplicated symbols anymore. I hope it makes sense.

Duplicate symbol for class in library and project

I am using SBJson classes in my library and having tried to use the library in my project I am having a duplicate symbol error because I am also using these files in the main project.
I can't add prefixes to these files so how does one usually work around this problem ?
I saw other answers that suggest renaming classes with prefixes, yet this isn't really the solution since it's correct that these files have duplicates - it's an open source code.
You could remove the SBJSON (.m) files from the library project target (using the "Build Phases" screen in Xcode) and then project should be able to compile using the SBJSON files that are part of the main project. There might be issues though, if both projects use different versions of the SBJSON library.
Personally I wish all library projects didn't include other libraries but note (in a "Read Me" file or whatever) that it's a dependency and it's up to the developer to include the dependencies in the main project. I've had a lot of issues with duplicate symbols in the past due to this stuff.
Just Go to Build Setting and
search for No Common Blocks and
set it NO.
And build again you will not get this error again.
CheersKP
You can just include the .h files in your project and remove .m for SBJson. That way you can import the .h in you code and it will compile.

Framework header not found in Xcode 4.2 but application runs fine

I have a Mac app that uses a framework.
In build phases, I've added the framework to Link Binary With Libraries and created a Copy Files build phase to copy the framework. Furthermore, I'ved added the framework search paths to Framework Search Paths, Header Search Paths, and User Header Search Paths. The path is as follows:
../UMEKit/DerivedData/UMEKit/Build/Products/Release
I can build and run the application however next to the header import statement #import "UMEKit/UMEKit.h", there is a red maker indicating that the header is not found.
I've also tried restarting Xcode and my computer a billion times and haven't been able to resolve the problem.
Any suggestions on what I might be doing wrong?
Do not use quotes when importing something from a framework. Use <> instead. For example
#import <UMEKit/UMEKit.h>
This will work.

Cannot find output .a of Cocoa Static Library (in xcode 4)

I have a project with two targets, one is a Cocoa Static Library, the other is the accompanying test project. Despite building the main project in different ways over and over again, I cannot find the .a file that I expect it to produce.
In fact, I cannot find the build folder associated with the project. I need to link to the library in an app, but cannot do so if I can't find the file to link to.
These properties are correctly set:
(Build Products Path) SYMROOT = build
(Intermediate Build Files Path) OBJROOT = $(SYMROOT)
All tests pass (which means the code MUST be building right?)
Breaking the code causes the build to break - again suggesting that it is building.
Also, the "Products > libproject.a" file is red in the xcode project navigation
I also checked the DerivedData directory, but all the seems to get created is the objects fot the OCunit stuff. Still no .a file against which I can link.
Where is my .a file?
Any help would be much appreciated.
It's probably in ~/Library/Developer/Xcode/DerivedData/ somewhere.