使用同一个库的两个版本 [英] Use two versions of the same library

查看:126
本文介绍了使用同一个库的两个版本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在iOS项目中工作,其中包含由另一家公司创建的静态库。
该库包含旧版AFNeworking,我没有任何源文件。

I'm working in a iOS project that includes a static library created by another company. The library include an old version of AFNeworking and I don't have any source files.

现在我需要使用更新的(并且更少的bug) afneworking的版本,但我不能在项目中包括同一个类两次(当然),因为所有的重复符号。

Now i need to use a more recent (and less bugged) version of afneworking, but i cannot include the same class twice in the project (of course) because all the "duplicate symbols".

我知道更换版本是不可能的包含在库中,但是如何在旧库中包含另一个版本?

I understand that it's impossible replacing the version included in the library, but how can i include another version along the old one?

在我的项目中包含之前,有一种(简单)方法可以重构整个框架吗?

There is a (easy) way to refactor the entire framework before include in my project?

谢谢

推荐答案

你必须重新打包静态库删除嵌入的AFNetworking文件。

You'll have to repackage the static library to remove the embedded AFNetworking files.

用以下内容解压缩库:

$ ar x libwhatever.a

并重新打包,包括除AFNetworking对象文件以外的所有文件:

And re-package it, including all files except the AFNetworking object files:

$ ar cr libwhatever.a file1.o ... fileN.o

然后,您必须将可执行文件与新的AFNetworking静态库链接,并希望没有API更改会破坏 libwhatever.a 。如果有,那么我怀疑你能做多少。

You will then have to link your executable with the new AFNetworking static library and hope that there haven't been API changes which will break the code in libwhatever.a. If there are then I doubt there is much you can do.

这篇关于使用同一个库的两个版本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆