让 Xcode 自动链接静态库中对象所需的库
我有一个 xcode 项目,其目标是构建“Cocoa Touch 静态库”,用户可以成功地从她的应用程序项目中依赖此项目并链接到该库。
但是,存档中的某些对象依赖于其他库,因此用户必须自己将这些对象添加到应用程序项目中。 Xcode 有没有办法消除这一步?即,我可以在库的项目中指定它所依赖的库,然后自动链接到应用程序吗? (在库项目中,或作为 xcconfig 文件,或任何有效的文件。)
I have a xcode project with a target that builds a ‘Cocoa Touch Static Library’, the user can successfully depend on this project from her app project and link against the library.
However, some of the objects in the archive depend on other libraries, so the user has to add these to the app project herself. Is there a way with Xcode to eliminate this step? I.e. can I specify in the library’s project on which libraries it depends which are then automatically linked in to the app? (In the library project, or as a xcconfig file, or whatever works.)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我最终选择了用户的应用程序目标配置所基于的 xcconfig。此 xcconfig 包含:
这与工作区中的库以及应用程序一起使一切正常工作。
I’ve ended up going with a xcconfig that the user's app target configurations are based on. This xcconfig contains:
This together with the library in a workspace together with the app makes it all work.
似乎来自 https://github.com/kstenerud/iOS-Universal 的“Fake Framework”模板-Framework 可能会成功,尽管显然它会在用户的项目构建中引入警告...:-/
不过,还没有尝试过,所以如果您知道其他/更好的方法(不会生成警告)请这样做 告诉。
It seems that the ‘Fake Framework’ template from https://github.com/kstenerud/iOS-Universal-Framework might do the trick, although apparently it will introduce a warning in the user’s project build… :-/
Haven't tried it yet, though, so if you know other/better ways (without generating a warning) please do tell.