views:

48

answers:

1

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?

+2  A: 

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.

Alexsander Akers
I've tried using `#import <PFLetsMove/PFMoveApplication.h>` and it does the same thing...
jfm429
Okay. I downloaded it and from what I can tell, the files in there don't build a framework, they build an application. Just drag the two source files and any language resources you want into the app.
Alexsander Akers
Those are angle brackets. Square brackets are what you use for message expressions (`[]`).
Peter Hosey
Thanks, Peter. I knew they weren't square brackets but I couldn't remember the name.
Alexsander Akers
Actually they do build a framework: see this [screenshot](http://cl.ly/2Zmv). The resulting framework contains the PFMoveApplication.h file but when used in my application (by including the PFLetsMove Xcode project in my application's Xcode project) the two #import statements don't work. The #import statement using the quotation works fine for Aquatic Prime, but not this framework.
jfm429
Perhaps if I could so some of your code, it would be easier for me to understand the error. Did you remember to copy the framework into your app's bundle?
Alexsander Akers
I can't show you a lot, but there's this: EDIT: Since the comments don't allow full Markdown I'll post the info in the next couple comments...
jfm429
In the App Delegate: `#import "PFLetsMove/PFMoveApplication.h" - (void)applicationWillFinishLaunching:(NSNotification *)notification { PFMoveToApplicationsFolderIfNecessary();}` (Hopefully that gets formatted properly...) EDIT: Nope... Stack Overflow needs full Markdown comments... really...
jfm429
Now for the screenshots. Before compiling I have [these projects included](http://cl.ly/2bmn) and [this target structure](http://cl.ly/2b3L). Notice I've simply dragged the Xcode projects for the frameworks into my project and set up the dependencies on the frameworks. Note also that all frameworks are red (missing). Now after compiling I have [this include view](http://cl.ly/2bSg) and [this target structure](http://cl.ly/2b0A). Note that after compiling, the PFLetsMove framework is no longer shown as missing, and the other ones look like they _are_ missing. However, `#import` statements
jfm429
for the other frameworks (i.e. `#import "AquaticPrime/AquaticPrime.h"`) work fine, but `#import` on the PFLetsMove framework fails. I'm trying to figure out why the other ones are red yet still work fine, but PFLetsMove looks correct, works properly, but fails when I try to `#import` the header. I've compared the build settings of PFLetsMove and AquaticPrime and I couldn't see anything wrong, though I'm not familiar with all of the compiler settings and how they affect frameworks, so...
jfm429
Okay. I'm really stumped. Tell me if you figure it out. Sorry…
Alexsander Akers
I just discovered something interesting. It has something to do with where the projects are. If I take ~/Folder1/MyApp/MyApp.xcodeproj and depend on ~Folder2/Framework/Framework.xcodeproj, it fails. But if I depend on ~/Folder1/MyApp/Framework/Framework.xcodeproj, it works fine. I just took another application that worked perfectly fine with the Sparkle framework, added the Sparkle .xcodeproj, and added Sparkle.framework. Immediately that caused the line `#import "Sparkle/SUUpdater.h"` to fail.
jfm429
So it has something to do with the method of adding the project as a dependency. The process I use is: drag dependency .xcodeproj to the sidebar, double-click my target, add the framework as a dependency, then drag the framework from the subproject to the Link Binary with Libraries and Copy Files (Frameworks) build phases. It works fine if the dependency project is in the same folder as the container project's .xcodeproj but not otherwise. I've had no problems in the past dragging .framework files in and just directly using them...
jfm429
I just think you should compile the frameworks and include those. Considering the source code of the external frameworks doesn't change until new releases are out, you can just replace the old ones when there are new ones.
Alexsander Akers
Yeah, I've kind of been thinking that too. I'd really like to get this method to work, since it's supposed to be a good way to do it. I'd still be interested in ways to get it to work... anyhow, thanks for your help.
jfm429
You have to remember that even if you link directly to the product, you'd have to replace the project if you updated the source code. I'm glad it all worked out in the end, though.
Alexsander Akers
Well, the projects are Git repositories so all I'd have to do is update them, but it's not much more difficult doing it manually. :)
jfm429