Library->Cocoa Touch Static Library\" of Xcode. I compiled it and it works fine. Then I wanted to include this library in a new project. Here i" />
开发者

Including a static library in a Xcode project

开发者 https://www.devze.com 2023-01-08 20:58 出处:网络
I have developed a static library using the \"iPhone OS->Library->Cocoa Touch Static Library\" of Xcode. I compiled it and it works fine. Then I wanted to include this library in a new project. Here i

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

  • Create a new Xcode project "View-based application"
  • Project->Add To Project : I added my static library .xcodeproj file
  • Project->Edit Active Target
    • In General tab : I've added the static library in the "Direct Dependencies"
    • In Build tab : I've added the path of the headers in the "Header Search Paths" In "Search Paths" section
开发者_JAVA百科

Then I tried to use one of the classes I've put in my static library, but I get a linking error :

"_OBJC_CLASS_$_GenUIImage", referenced from:

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

Symbol(s) not found

Collect2: Id returned 1 exit status

I do not get what I did wrong. Please help. Thanks in advance


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

However I have an other problem.

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

0

精彩评论

暂无评论...
验证码 换一张
取 消