Search code examples
iosxcodestatic-librariesarchivebuild-settings

Archive contains linked static library


I have a project containing multiple static library projects inside it. All the libraries compiles fine and App is also working fine on tablet. But while creating an archive on Xcode 9, static libraries that were linked in Build phase are getting copied in it. Due to this archive created is generic archive, thus unable to create ipa.

I am creating 2 targets for each library:

  1. Library Target: Compiles library and copies to the required folder. [refer screenshot]. LIBROOTDIR is my output folder where I am keeping all libraries and header files.

  2. Export Target: Copies header files to required folder. enter image description here

In my main project, I have added the Library Project Target in dependencies in Build Phase.

I have tried following things to resolve after doing some google but failed:

  1. Made Skip Install to YES for static library and NO for App, as per https://developer.apple.com/library/content/technotes/tn2215/_index.html
  2. 'Strip Linked Product' to YES for App project. Most of the settings are default. enter image description here
  3. Deleted the derive data folder and rebuild the App.
  4. Verified that correct scheme is selected and only one Archive is selected for that.

Even after trying all the steps, static library is coming inside the archive.[path of static library is similar to that of LIBROOTDIR.]

I know that I might be forgetting some little point to resolve but unable to figure out that.


Solution

  • I know its late but I got it fixed through below changes. I changed in Target -> Build Phases -> Copy Files

    1. the Destination as Products Directory
    2. the subpath as include/${PRODUCT_NAME}

    Hope that solves others problem.