Alright, so I've been trying this for several hours, and I've read page after page after page after page and done everything they say, but I can't quite seem to get this to work.
I'm trying to develop a centralized collection of classes and methods that I can use across all my apps, so I've made a Library project in Xcode and I'm trying to link the first of my apps to it. According to the links above, it should be fairly simple, but I can't seem to get it working.
What I've done:
1) I've added the Library project (the blue .xcodeproj
file) as a sub-set of the App project in Xcode, which resulted in the full expandable/collaspable Library project appearing within the App project filetree. (If it matters, I've added it directly under the Target header, within the App project but outside of any folders like "Supporting Files" or "Frameworks".)
2) I've added the Library project as a Target Dependency in the App project's "Build Phases" section.
3) I've added the Library project's .a
file to the "Link Binary with Libraries" section in the App project's "Build Phases" section. (Notably, in both sections it appeared as an option when I went to add a file, so the Library project does seem to be registering, but in the "Link Binary with Libraries" section its title is written in red once I add the .a
file.)
4) I've added the .h
files of every class in the Library project to the "Build Phases > Copy Files" section of the Library project.
5) I've added -ObjC
to the "Other Linker Flags" row of "Build Settings" in both the Library project and the App project.
6) I've made sure I'm in the right Target for the App project during #2-3.
7) I've tried both #import "LibraryClass.h"
and #import "Library/LibraryClass.h"
in my App project files, with both quotes and triangle brackets. Either way, it doesn't autocomplete and it gives a red "file not found" error if I type it manually, and it doesn't accept references to such a class anywhere in the App project files. (For what it's worth, autocomplete DOES still work for classes from within the App project.)
And yet:
My spidey-sense is telling me that there's something simple that I'm missing here, but I can't quite get it. I just want to be able to #import
and use classes from the Library project in my App project files.
Can someone nudge me in the right direction?