在iOS中将开源代码嵌入静态库的稳定方法? [英] Stable way to embed open-source code into static library in iOS?

查看:85
本文介绍了在iOS中将开源代码嵌入静态库的稳定方法?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在制作一个静态库,供其他开发人员使用。换句话说,一种API。

I'm making a static library for distribution for other developers. In other words, a kind of API.

我必须使用一堆开源库,如 SBJSON ASIHTTPRequest 。我认为如果我将这些类在源代码级别嵌入我的库中会产生名称冲突问题。据我所知,Objective-C运行时不支持私有类。

And I have to use bunch of open-source libraries like SBJSON, ASIHTTPRequest. I think it'll make an name conflict problem if I embed these classes into my library at source level. As I know, Objective-C runtime doesn't support private classes.

那么有没有一种方法可以将这些类包含到我的库中而不会出现名称冲突?

So it there a way to include those classes into my library without name conflict?

推荐答案

只是不要!

只需告诉您的用户,他们应将SBJSON或ASIHTTP链接到他们的应用程序中,以使您的工作正常运行。这就是应该处理这些问题的方式。在库中拥有依赖项没有任何问题。通过重构标准库(例如重命名SBJSON类)来解决这个问题不是一种可行的方法。

Simply tell your users that they shall link SBJSON or ASIHTTP into their app to get your stuff working. That is the way those issues should be handled. There is nothing wrong in having a dependency in your library. Solving this by refactoring a standard library (e.g. renaming SBJSON classes) is NOT a way to go.

这篇关于在iOS中将开源代码嵌入静态库的稳定方法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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