Xcode 4 build class conflict

Hi everyone, I am new to Xcode / Cocoa / Objective-C and am experiencing an annoying problem that I cannot track. I have a program with several classes and a set of unit tests built into the Xcode parameter "include unit tests" is checked when creating a project. For the most part, everything works fine, but when I run my tests, I see the following error:

objc [12505]: The class [class foo] is equally implemented in both / Users / [i] / Library / Application Support / iPhone Simulator / 4.3 / Applications / 1F5222ED-0A3C-41BC-AFA3-CB8FC744EFCE / [application name] .app / [application name] and / Users / [i] / Library / Developer / Xcode / DerivedData / [application name] -eumytpkyfitihadpqeyxjpwapxoa / assembly / Products / Debug-iphonesimulator / [application name] Tests.octest / [application name] Tests. One of the two will be used. Which one is undefined.

A search of the logs to build the test target shows that Xcode compiles the [class foo] for the test target, but not one of the other classes that the test program uses (apologizes if my terminology is incorrect).

Top of my file [application name] Tests.m:

#import "[app name]Tests.h #import "[class x].h" #import "[class y].h" #import "[class z].h" #import "[class a].h" #import "[class foo].h" 

[application name] Tests.m uses all of the above classes, while [class foo] has no real meaning that I can think of, except that it was created first. I tried moving the ad #import "[class foo].h" unchanged. I tried to rename [class foo], clean up the product and rebuild without any changes.

Looking at the files in the Finder, all the program classes are in the root directory for [app name], and only two test files are in the root directory for the [app name] tests, which, I believe, is the same as it should be.

Often, running tests will actually work even with this error, but sometimes it will not or breakpoints will run unpredictably in [class foo], which is really annoying. Any thoughts or suggestions would be appreciated.

Thanks.

+4
source share
1 answer

Hey, I don’t know if it solves your problem, but it seems that you need to rebuild your derivative folder.

I am having problems with classes of old projects after the upgrade. I solved the problem by removing the application from the simulator, cleaning up the project and going to the derived data folder in / Users / [me] / Library / Developer / Xcode / DerivedData /

You can delete the entire folder with the name of your application. Xcode rebuilds it on its own. Another method that sometimes works is to create a new project with Xcode 4 and move all the files of your project to this new project. This ensures that you do not have problems with updated project settings in Xcode4.

+2
source

All Articles