Library -> Cocoa Touch Static Library" Xcode. I ...">

Including a static library in an Xcode project

I developed a static library using the "iPhone OS-> Library -> Cocoa Touch Static Library" Xcode. I compiled it and it works great. Then I wanted to include this library in a new project. Here is what I did:

  • Create a new Xcode project "View-Based Application"
  • Project-> Add to project: I added my static library .xcodeproj file
  • Project-> Change Active Goal
    • General Tab: I added a static library to Direct Dependencies
    • In the Build tab: I added the heading path to the Header Search Paths under the Search Paths section

Then I tried to use one of the classes that I put in my static library, but I get an error:

"_ OBJC_CLASS _ $ _ GenUIImage" referenced by:

Objc-class-ref-to-GenUIImage in TestViewController.o

Symbol not found

Collect2: Id returned 1 exit status

I do not understand what I did wrong. Please help. thanks in advance

0
source share
1 answer

I have found a solution. I dragged the .a (library file) into the "Link Binary With Libraries" of the main target of the project.

However, I have another problem.

My static library contains a class that requires an AudioToolbox structure. I added it to my static library. However, I need to add a framework inside the project. Is there a way to avoid duplicating the structure in the main project?

+1
source

Source: https://habr.com/ru/post/1011927/


All Articles