Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7585113
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T19:05:40+00:00 2026-05-30T19:05:40+00:00

I have created two separate static libraries in Xcode for usage on iOS, A

  • 0

I have created two separate static libraries in Xcode for usage on iOS, A and B. A uses methods that are defined in B.

When creating a new Xcode project where both A and B are needed, I can include them separately. However, for simplicity of integration I prefer to create a Universal Framework that contains both A and B.

Is it possible in Xcode to merge 2 static libraries into 1, without merging the code of the 2 libraries in 1 project. In other words. Can I somehow link the compiled static library B into static library A when I am compiling/Linking static library A?

If this is possible, how can I accomplish this?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T19:05:42+00:00Added an answer on May 30, 2026 at 7:05 pm

    I’ve just run some quick tests and it seems to be happening automatically. This is what I did:

    • I used DerivedData folder as a default build location for all 3 projects (this is default in XCode 4.2 which I use)
    • I changed Public Headers Folder Path to include/ProjectX where X is the name of the static library. I did this step only for static libraries A and B, not for the project that will actually link them. This step is to be able to import the headers like <LibX/Header.h>.
    • I made library B direct dependency of the library A and linked A against B
    • I made library A direct dependency of the main project and linked main project against A

    After this basic setup, I imported classes from B to A with something similar to <LibB/Header.h> and wrote some code that actually made use of B. Then, I imported A and B to the main project with <LibA/Header.h> and <LibB/Header.h> and wrote code that made use of A and B. Finally, I went to the DerivedData folder with the terminal and navigated to the location where A is built. I checked if LibA.a contains objects from LibB with:

    nm LibA.a
    

    And yes, it contains objects from LibB. So, to sum up, with this simple dependency setup you should be able to get what you asked for.

    EDIT
    To make B direct dependency of A and link A against B do this:

    Having A open in the XCode, go to Finder and drag&drop B project file into A. Then, choose the root element in A, go to Build Phases, expand Target Dependencies, press ‘+’ button, choose B and confirm. then expand Link Binary With Libraries, press ‘+’ button, choose B.a (or whatever the product name is) and confirm.

    Important
    There is a bug in XCode that prevents you from properly dropping B project file into A workspace. Instead, you are left with B project file in A workspace, but you cannot expand B and do anything with it. To work around this problem, remove the faulty B project file reference from A, close A, close B if you have it open. Then reopen A and use Finder to navigate to B project file, then drag&drop B inside A workspace. If didn’t work, repeat.

    EDIT2
    I case you don’t have access to the sources of B (and possibly A), making this work is just a matter of copying the required headers in the proper place. Then in you main project, you don’t make the A direct dependency, instead you link against static libA.a that you have. If A uses B, then the symbols from B are already in the libA.a. You can check this with nm tool like I do above. So we are down to exposing those symbols to the main application with B headers. There are a couple of ways to do it, I remember that I simply copied the headers to the Copy Headers destination path of the library that is in the middle of the dependency chain. After that, by linking against A and adding A headers to User Header Search Paths I was able to access B directly. What is the best way to do it for you depends on if you have access to the sources of A. If you have, there are two options to consider:

    • Add B headers to A (they will be automatically copied to the A headers destination). But I guess you don’t want this solution.
    • Add custom run script build phase to A target, which will grab the B headers and copy them to A headers destination.

    In both cases, you end up with LibA.a which holds compiled sources of A and B, and the headers folder which holds headers from A and B. You can then link your main project agains LibA.a and add the headers folder path to the User Headers Search Path in you main project, and you should be good to go.

    Important

    If, in your libraries, you have files that hold only category code in them, make sure to link this library with -force_load, or your category symbols will not be packed properly.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

My app uses two databases (separate files). To handle these databases I have created
i am new to solr. I have created two separate entities which are not
I have a problem with two separate transactions that are flushed to the database
I have created two separate UserControls and (depending on which RadioButton is selected) I
I have created two forms in my Windows Application. One Form acts as a
I have created two files: tunables.h #ifndef TUNABLES_H #define TUNABLES_H void tunables_load_conservative(); void tunables_load_aggressive();
I have created two JavaScript files. One file is "validators.js" and the other is
Let's say I have created two objects from class foo and now want to
I'm having a problem with mixing managed and unmanaged code. I have created two
I have created an item swapper control consisting in two listboxes and some buttons

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.