Hi My app storyboard works and I can link the custom class of my MainProject Storyboard to Static Library ViewController but my problem is when i try to use #import from my MainProject to locate for header files, my header files in my Static library doesn't show up.
here's my project settings(SecondSample is my Static Library)
My MainProject header search path
My Static Library build setting
I hope someone can help me with my issue. Thanks in advance :)
EDIT: I didn't copy my static library to my MainProject folder... I've just add a reference to it.
Related
I created a static library in Swift and the goal is of course to distribute this and reuse this library in another project. In the project where I want to import this static library I do the following:
Drag xcode project from static library in Project Navigator
Drag xxxx.a (inside Products folder) to Build Phases > Link binaries with libraries
In the class where I want to use this library add: import MyStaticLib
Unfortunately I get an error saying: No such module 'MyStaticLib'.
But then when I create a new project in Xcode and do the exact same steps there's no error at all and I'm able to use the library in any class that imports this library. I looked at both project settings and can't seem to find anything weird.
Settings like Header Search Path and Library Search Path are empty in both projects.
Can someone point me in the right direction?
I have created a static library using Objective - C and generates a library called: libDummy.a, with header called ClassOne.h and ClassOne.m, then I need to add this library into another project, but it keeps reporting "libDummy/ClassOne.h" cannot be found.
And I have copied the libDummy.a to the same folder as the new project, also I checked the Search Library path, it's pointing to the correct folder, but the problem still exists.
Any idea about how to fix that?
try this,
1) Remove all the files and re-add them to project bundle, but dont forget to select as shown in below image,
2) Recheck library path again and add.
Link the library file in build Phases
Xcode->Build Phases -> Link Binary with Libraries
Add your .a file here.
I have a static library project and in that project I linked a .xcodeproj to the source code so I can update easily actually and to not copy and paste files in the static library project for easy update.
The purpose thought it's to embed this .xcodeproj with my code into the result static library or .framework that I will build using a script.
Although I can see that there is nothing added in the compile sources or the copy header files which I added. If I try to add with drag and drop files from the linked project to my static library build phases copy header section it copies the file to my project again, but I don't want this.
And if I add a header file #import to one of my public headers and try to use the static library to the client project it complains that the header is not found!
So, in the end, what I want is the whole linked project files to be copied in the resulting static library or .framework with the scripts and target I have.
Is this possible to achieve, I think I miss some project setting that I'm not aware about that will see and copy all header and implementation files to my result static library or .framework?
Is my approach overall correct? I don't think that there is no option to use a linked project in a static library and embed it when the build is happening since I am using it in my project!
I could add the .framework of the third party component too and merge to my static library. I have created this question earlier today. Is it possible to include a .framework in a .framework and how?
Regards.
Not sure if your #import-not-found issue is a linker issue, but...
Make sure to use the -ObjC flag in "Other Linker Flags" in the library's Build Settings. This gets the linker to build everything in the library.
Mentioned here:
https://developer.apple.com/library/ios/technotes/iOSStaticLibraries/Articles/configuration.html
And also make sure you link in the library in the build settings for the project that needs it.
I made one really basic static library prints only one string on the screen. I made it for ios device and I added header files in copy headers --> Project. The main .h file is SampleSubproject.h . After running I found the libSampleSubproject.a and copy to my project. When I am trying to use the library I call it in my .m file like
`#import "SampleSubproject/SampleSubproject.h"`.
it gives error
"SampleSubproject/SampleSubproject.h" is not found.
Is it possible to use headers from library without making them public?
As of i know, You can't. Since you are doing as a static library, you should add the header files.
I am creating a static library which i will be using for more than one projects, which i am developing. I will build the static library as .framework file and will drag and drop to use in other projects. It is working fine. Now i am adding some more functionalities to the framework. I am adding FacebookSDK.framework to the static library for log in purpose, but when i drag the framework to another project and build it, it throws an error.
"FacebookSDK/FacebookSDK.h" file not found.
Please help!
You should change your import statement to
#import "FacebookSDK.h"
And add FacebookSDK.framework to the project which USES your static library.
If you want to build FacebookSDK.framework INTO your own static library. You should open FacebookSDK.framework and find all the .h and a file named FacebookSDK, and add these files into your static library project.