This seems like a simple issue but I can't find any resolution to it.
I have an XCWorkspace that contains Project A, and Framework B, and 3rd Party Library C (kingfisher)
Project A Embeds & Signs framework B
Framework B has dependancy on Library C
Now if I keep it as such, when building to my iPhone, I get a "library not loaded: kingfisher ", then if I add kingfisher to Project A, I can build fine, but when I archive it, I get an error that both Framework B has a duplicate call to Library C. But if I remove library C from framework B, I get a build error cause I'm trying to "import kingfisher".
So to sum it up:
if C is added to A only -> Build error
if C is added to A & B -> Archive error
So how does all of this work? where should the dependancies be?
Related
I have two Objective C dynamic frameworks X and Y and another Objective C app Z.
All these frameworks and apps have been created by me locally. Framework X is the very base framework used by framework Y and the app Z. So the dependency graph is something like the following:
Y ---> X
Z ---> X
Z ---> Y (---> X)
I want all my targets to be debuggable and to pick the platform tools based on run destination (device/simulator). So I have added dependencies as sub-projects to the main projects and have linked them with the dependent projects to generate implicit dependencies by Xcode.
The set up 1 and 2 works great independently. But I am struggling with the set up 3 which is creating duplicate build rules for the target X due to transitive dependency on it (target Y and Z both depends on it) and subsequently failing the build process.
Anyone has any idea on how to deal with this situation? Thanks in advance!
It seem that in Objective-C, We can't link a dynamic framework to another dynamic framework, or to a command line tool. It's always raise an exception, when running in production
Dyld Error Message:
Library not loaded: #rpath/XFrameworks.framework/Versions/A/XFrameworks
For your situation, What I think might solve your problem
X (Core features) can be built in static library
Y can be built in type of dynamic framework
will link with X library
or link with others (I mean some another code base)
Z (your application) will link with Y framework
Actually there is a way through which I could finally solve the issue of transitive dependency in Xcode. I have to use Workspace (.xcworkspace) rather than a Xcode project (.xcodeproj).
To get it done use the following steps:
Close all related and open Xcode projects.
Create a new Workspace in the root directory from File > New >
Workspace. Open the workspace by double clicking onto it and
drag/drop the required projects to the workspace.
Add the independent framework (X in my question) output to both of
the dependent project targets (Y and Z) by adding it under the
Framework and Libraries section. Embed the dynamic library only to
the top level application (Z) and do not embed it to the
intermediate dependent target library (Y).
Add the intermediate framework (Y) to the root level app under
Framework and Libraries section and embed it to the root app bundle.
This setup works like a charm for me without ever creating duplicate build rules and it spontaneously picked up the dependency as well.
Obviously, you can not do this if your independent framework is a static library and in that case it will be linked to both the dependent targets causing duplicate symbols issue during linking.
I have an iOS project which developed by both Swift 4 and Objective C, everything is fine when Xcode 9 is used.
After upgrade XCode to 10.0, my swift classes cannot recognize Objective C classes and libraries, which produce error
'{project_name}-Swift.h' file not found
and
Use of undeclared type 'xxxxx'
Latter error appears at least in the followings situations:
System objective C class (such as UIImage, UIView...)
Objective C class in cocoapods libraries (such as AFNetworking 2...)
Custom objective c class
#define variables in .h file
I am still using Swift 4 yet (not 4.2). Tried clean the build folder and remove DerivedData and build again, these errors are still exist.
I solve the issue by moving one of the framework in Build Phases.
Targets -> Build Phases -> Link Binary With Libraries -> (remove) framework
When look around Link Binary With Libraries, I notice there are some Frameworks which icon has a lighter color (seems deactive), after remove the framework and build again, things are okay.
For my case, I remove the Bolts framework which is installed accompany with Facebook SDK. Previously, I change to use Cocoapods to update Facebook SDK instead of adding the Facebook SDK library to the project manually.
I have a workspace that contains multiple projects - Project A and Project B. In this case, Project B is a dependency of Project A. When Project A is built, project B is then added as a dynamic framework to Project A.
- Project A
- Framework 1
- Project B
- Framework 1
Both Project A and Project B rely on a framework (Framework 1). I add this framework to both projects by going Build Settings -> Framework Search Paths -> Add path to Framework 1. When I compile the project, I get Xcode warnings saying:
Class XXX is implemented in both PATH 1 and PATH 2. One of the two will be used. Which one is undefined.
What I really want to do is to tell Xcode to link the Framework with both sub projects but to understand that this is one common library that doesn't need to be duplicated. I have two questions:
Is this possible?
If it's not possible, will this warning cause any problems? For example, is it that Xcode will just use the source code from either Framework location or is it that Xcode could run parallel instances of the framework code which could cause issues with singletons being duplicated.
As mentioned in title I need some help on working workspace with static libraries!
This is my situation:
App project;
Library A
Library B
The depends:
App projects depends by Library A and Library B
Library A depends by Library B
Library B is atomic
So ... I have tried a lot of configurations, linking B to A, and A to App; or linking B to A and A & B to App ... but always have error from linker. In first case linker cannot find symbols of library B, in second case linker return error of symbol duplicate in A and B!
Someone can help me please???
Static libraries can't link with each other. If Library A depends on Library B, all you need to do is to link your App to both libraries A and B.
If you still get a linker error, my guess is that one of the libraries adds an Objective-C category and you've run into the well-known issue that needs to be resolved with -force_load. See this answer.
I'm currently writing a unit test project using the version 4.6.1 (Windows Vista + Eclipse). My project is divided in 3 part:
A. Unit test application (type:CLDC application)
B. Application to be tested (type:CLDC application)
C. A library project (type: library,no .jar file imported)
The A project should reference the code present in B (and of course even in C). I would like to specify that I can run without problems the project B (referencing C). My problems start when I try to run the project A.
I performed the following operations:
changing the B project type from CLDC application to library
B references the project C
A references the project B
set all project as "Active for Blackberry"
Basically A sees the two other project as two nested libraries.
The code is built successfully,but the problem is that when a class of the C library is called by B during the execution, the following exception is thrown:
NoClassDefFoundError
No detail message
Any help would be really appreciated.
Many Thanks
A NoClassDefFoundError means that A cannot find C at runtime. The usual cause is that C failed to be deployed onto the target device (simulator or real device).
Solution 1:
For project A under Project->Properties->Java Build Path ensure C (your library project) is listed under 'Projects' and the corresponding checkbox checked on the 'Order and export' tab. This should ensure that the library is exported during the build and deployment process.
Solution 2:
In project A add a symbolic link (right click project->Build Path->Link Source) to the library C source. This will force the library's source code to be included when project A is built.