如何在同一个项目中有两个同名的objective - C类?(复制)

时间:2022-08-11 16:50:30

Possible Duplicate:
What is the best way to solve an Objective-C namespace collision?

可能的重复:解决Objective-C命名空间冲突的最佳方法是什么?

I was using 2 open source projects in an application with different use --- the issue was that both project had same class name with different implementations.

我在一个不同用途的应用程序中使用了两个开放源码项目——问题是,两个项目都有相同的类名和不同的实现。

As per my understanding objective C don't have namespace option to handle scope --- as of now I am renaming the one of the class and its usage to make it work in my project.

根据我的理解,objective C没有名称空间选项来处理范围——到目前为止,我正在重命名一个类及其用法,以使它在我的项目中工作。

Is there any alternative solution then renaming? I feel like objective C is missing namespace.

有什么替代方案可以重命名吗?我觉得objective C缺少命名空间。

1 个解决方案

#1


6  

Renaming is the correct way. There is a reason why Apple recommends to prefix your classes with some uppercase letters. This should prevent exactly this situation. Same for method names in class extension, or "private" methods.

重命名是正确的方法。苹果推荐在类前面加上一些大写字母是有原因的。这应该可以避免这种情况。类扩展或“私有”方法中的方法名也是如此。

#1


6  

Renaming is the correct way. There is a reason why Apple recommends to prefix your classes with some uppercase letters. This should prevent exactly this situation. Same for method names in class extension, or "private" methods.

重命名是正确的方法。苹果推荐在类前面加上一些大写字母是有原因的。这应该可以避免这种情况。类扩展或“私有”方法中的方法名也是如此。