我正在开发几个iOS应用程序,它们共享一些常见的第三方库,以及我自己的一些共享代码。
这是我的文件夹布局:
- three20 /
我所有应用的常见设置:
-Shared/*chibiORM* (ORM layer)
-Shared/**BaseApp** (This link to chibiORM & three20)
---------------/Libs/(Several small 3dparty libs)
此应用必须链接到BaseApp,并且有三个,chibiORM& 3dparty-party libs访问..
- App1
- App2
- AppN...
我知道如何将静态lib链接到单个项目,但无法进行多链路设置,其中BaseApp链接到three20,chibiORM,其他实用程序和App1..N链接到之前的所有。
我不想逐个链接到每一个(我当前的设置),而是一次性连接所有这些。
我可以编译精美的BaseApp,只需添加项目/拖放即可到App1。然后,我把header / frameworks / Library Paths指向所有这些(我想知道这是否可以简化为单个路径,而不是在这里放5)但是从BaseApp链接的每个lib都会出现这个错误:
Undefined symbols for architecture i386:
"__ALog", referenced from:
-[App1AppDelegate closeDb] in App1AppDelegate.o
-[App1AppDelegate application:didFinishLaunchingWithOptions:] in App1AppDelegate.o
-[BoardViewController cardSelected:indexPath:] in BoardViewController.o
-[BoardViewController gestureRecognizerShouldBegin:] in BoardViewController.o
-[BoardViewController moveActionGestureRecognizerStateChanged:] in BoardViewController.o
-[BoardViewController finishedSnap:finished:context:] in BoardViewController.o
-[BoardViewController animationDidStop:finished:context:] in BoardViewController.o
...
"_sqlite3_unicode_free", referenced from:
-[App1AppDelegate closeDb] in App1AppDelegate.o
"_sqlite3_unicode_load", referenced from:
-[App1AppDelegate application:didFinishLaunchingWithOptions:] in App1AppDelegate.o
"_OBJC_CLASS_$_Db", referenced from:
objc-class-ref in App1AppDelegate.o
这可能吗?
答案 0 :(得分:0)
我最终将其结合起来http://blog.carbonfive.com/2011/04/04/using-open-source-static-libraries-in-xcode-4/& http://www.clintharris.net/2009/iphone-app-shared-libraries/
(错误是因为我忘记将lib链接到项目,与btw问题无关)。
主要技巧是静态lib目标中的set the install directory到$(BUILT_PRODUCTS_DIR)
。