I am trying to build a static library which is using a third party framework. It is built successfully.
But, the problem is, when i am including my static library into any sample application, the sample application is also asking for that third party library which is used under my static library.
Why the Sample application is asking for that framework, if it is already used inside by static library?
I dont know if this will some one.... but goto BuildSettings -> Architectuers -> Under BuildActiveArchitecture Only , there set NO and then generate library.
if you have not used the "code" of lib(third party) during compilation and have used only .h files and .a file, then your library is dependent for executable code on the other static lib and hence it will be required.
the only way to remove the dependency is to compile the source of dependent(third party) static lib with your static lib code so the lib is generated having executable code of the dependent lib.
Related
I need to create a framework in swift, that will internally use a static library. It would be great if this library was only visible internally in this framework. I have added all the files of this library to the framework, and I have created a module.modulemap file. This file looks like this:
framework module MySDK {
umbrella header "MySDK.h"
export *
}
module BluFi {
header "/Users/homedudycz/Documents/Developer/MyApp/MySDK/blufiprotocol/DH_AES.h"
export *
}
And I can now use objects from this static library inside my framework, but there is a problem. When I try to import my framework in some app I get an error: Missing required module 'BluFi'.
What am I doing wrong? Is there some other way to import this static library inside my framework internally?
I have also created a sample project with libraries that I need added in this SDK. Please take a look, and please update path in module.modulemap - I don't know how to make it relative to SDK path :/
https://www.dropbox.com/s/rnh7y7zr63zillv/TestApp.zip?dl=1
I created a library that uses the native navigation controller to navigate through react and native screens. The library is written in Swift and contains some objective-c code to setup the React bridge etc. Currently I can distribute this library through CocoaPods by creating a podspec and defining the React dependency there. However, this forces the user to setup React in their project through CocoaPods as well (like so: https://facebook.github.io/react-native/docs/integration-with-existing-apps.html). I'd like them to use the react-native link or manually linking option as well (like so: https://medium.com/#joshyhargreaves/adding-react-native-to-existing-ios-project-without-cocoapods-6f1ee9106009).
If I understand correctly I can create a static library and distribute that. So far I created this static library, added my mixed swift and objective-c code and tried to manually link it into my main project. This however produces an error in one of my classes inside my static library where I import React like so import React. Error is "No such module 'React'.
I updated the Header Search Paths of my static library to contain:
$(SRCROOT)/../react-native/React
and
$(SRCROOT)/../React
(react-native, React and my own lib are all inside the node_modules folder)
both set to recursive. Unfortunately it still doesn't find the module React. Does anyone know how to create a static library that contains a dependency with React?
The end goal would be to import this static library in my main project like import MyStaticNaivationLib in one of my viewcontrollers and subclass from a class that's defined in my static library.
My main project also uses https://github.com/rebeccahughes/react-native-device-info. This looks exactly what I want to achieve. It's a static library that has a dependency with React ("import RCTBridgeModule.h") which I can manually link in my main project. Only difference is that this project doesn't contain Swift code.
I wrote a custom module for the company, and you can view my documentation. This custom module have inner framework and I link this framework to the main project. In your custom_modulem do you have package.json with this?
"peerDependencies": {
"react": "16.8.3",
"react-native": "0.59.4"
}
https://github.com/Hardy1207/RNOkay
I needed to create a framework (which requires a static library) for a project I'm working on. I used this tutorial to create the framework, then copied the static library into the project and it worked.
But, when I dragged the framework to an iOS project, it shows a ton of errors.
`Undefined symbols for architecture i386:"_OBJC_CLASS_$_SomeClassFromTheStaticLibrary",referenced from:_OBJC_CLASS_$_AnotherClass in MyFramework`
What I think is happening is that the iOS project wants to recompile the framework and it cannot, because it can't locate the static library. All errors disappear if I add the static library to the iOS project. This is what I want to avoid.
Basically I want to have the iOS project -> Framework -> Library instead of having the library in both the project and the framework.
I have tried adding the static library as a resource in the framework, but it didn't work.
I doubt this is possible. When you think about what is happening you will see the problem.
The framework is compiled and the static library is processed so that things like extra symbols are stripped out
The app is now compiled and linked against the framework which may or may not have had the symbols that the app is requiring
I did get this to work if ONLY the framework was using the static library (logical) but I can't find a way to share the code across the framework & the app.
If a symbol is hidden (either via Symbols Hidden by Default/GCC_SYMBOLS_PRIVATE_EXTERN being set to YES or __attribute__ ((visibility ("hidden"))) being applied to certain symbols), then that symbol will be available when statically linking the library, but not when dynamically linking the framework.
Ensure that the static library's symbols are not hidden, and you should be able to access them from your app.
I have followed this link to create custom framework. I have static library inside my framework and it works fine with that.
I have copied his steps in my blog for my understanding along with a script to make it universal.
I am trying to install app on device through private frameworks provided by xcode located at
/Developer/Platforms/iPhoneOS.platform/Developer/Library/PrivateFrameworks/
path.There are two frameworks
DTDeviceKit
DTDeviceKitBase
These are also used by "iPhone Configuration Utility". I want the main header files of these framework.
I tried
#import <DTDeviceKit/DTDeviceKit.h>
but I get compiler error because the DTDeviceKit.h is not found.
I set the
library search path="$(DEVELOPER_DIR)/Platforms/iPhoneOS.platform/Developer/Library/PrivateFrameworks"
other linker flag=-framework DTDeviceKit -Wl,-rpath -Wl,/Developer/Platforms/iPhoneOS.platform/Developer/Library/PrivateFrameworks
options.
Anyone has done anything like this? or
Is there any way to know the header files inside a framework?
As header files for private frameworks are not included in the SDK, you will need to reverse eningeer header files from the binary. class-dump is a nice utlity that helps a lot here :
Is it possible to do this in such a way that the parent project does not need any settings that refer to the sub-library -- only to the parent library?
(For example, I want header search paths to be picked up automatically).
I think you are looking for a Framework, not actually a static library ( You will always need the symbol references aka headers when you use static libraries )
The solution that Apple gave us, is Frameworks.
You can checkout this GitHub project which contains an Xcode 4 template for creating iOS frameworks again.
Good luck!