I am working on a project that was originally built in Xcode 4.0, and then ported to Xcode 4.2. Now I checked the migration to Xcode 4.5 and I get a ton of warnings as shown below ...
instance method 'values' in category from <pathToTheFile>/HistoryObject+extras.o conflicts with same method from another category
These warnings never appeared in previous versions of Xcode, and the code did not change.
The project is installed in iOS 4.3 for deployment purposes.
So, the previous developer has a bunch of classes like DAO, which, I believe, were automatically generated from CoreData, and then each of these classes has a category that extends it to implement certain methods. I will give an example ...
We have a base class named LisaObject, which inherits from NSManagedObject and has a category called LisaObject + extras. In LisaObject + extras, there is a method called "values" that returns an NSMutableDictionary.
Then we have a class called HistoryObject that inherits from LisaObject. There is also a category for the HistoryObject called HistroyObject + extras. This category also has a method called "values". In the HistoryObject + extras value method, it calls [supervalues] and then checks some conditions and sets some additional values ββin the dictionary that are not set in the base class method.
Then we have a class called LessonStatusObject, which inherits from HistoryObject, and also has a category called LessonStatusObject + extras, which has a method called values. This value method also calls [supervalues] and then does some extra work with the returned dictionary.
For each of these βvalueβ methods, we get a warning at compile time, as shown above, which indicates that the category has a method with a conflicting name.
I have a few questions about this.
First, can this implementation cause any legitimate problems, or are these warnings usually benign? I tried to think about how this implementation can cause ambiguity at runtime, but I do not see how this can happen.
Secondly, is there something I have to do to fix these warnings (and I donβt just want to make them stop appearing, I mean to correct the cause)? Is there any other way we should do this?
Also, why didn't Xcode 4.2 warn about this, but does Xcode 4.5 warn?
Am I misunderstanding something about the categories? I mean, if the "values" method was actually part of every implementation of the class, it would not be a problem to redefine them the way we do, but the compiler seems to complain just because it is a category. Is anything unsafe?
Any advice is greatly appreciated.
EDIT: Just to provide more information ... When we used Xcode 4.2, the Apple LLVM Compiler 3.0 was installed in the project. Now when I open the project in Xcode 4.5, it has a compiler installed in Apple LLVM Compiler 4.1.