Hosni
Hosni

Reputation: 668

renaming classes in iOS

I am working on Xcode 4.3.2 i wanted to rename my classes so i used refactor>rename, but after that i changed my mind and decided to go back to the older name. But when i do the same thing i've done before again, a warning dialog appears saying:

yourclass.h is not part of the build phase of any targets in this workspace and so can't be refactored. add the file to the build phase of a target in this workspace, or make a selection in another file.

what's the build phase? how can i solve this problem?

Thank you very much

Upvotes: 2

Views: 2246

Answers (5)

Don Miguel
Don Miguel

Reputation: 912

In my case the .m file was under the compile sources. I did clear the project derived data and restarted xcode but to no avail.

I figured out though, that attempting to refactor the specific property in the .m file worked and renamed the property both in the header and the rest of the project references.

Upvotes: 0

Damo
Damo

Reputation: 12890

It may be worthwhile to delete the projects derived data

  1. Organizer --> Projects --> hit the delete derived data button for the project in question

  2. Quit XCode

  3. Open XCode

  4. Build project. This will re-index your project and has been known to fix various environment issues such as

code sense

auto complete and

copmpiler targets

Upvotes: 3

Malek_Jundi
Malek_Jundi

Reputation: 6160

xCode usually takes snapshots when you rename the classes through the re-factor option .. you can go to File > restore SnapShote .. and choose the snapshot you want retrieve to and you will get back all the changed names.

Upvotes: 1

Brandon Schlenker
Brandon Schlenker

Reputation: 5088

In Xcode, select your project at the top of the file tree on the left hand side.

From there, select your target, and click the "Build Phases" tab. Make sure the .m file of the class you're wanting to rename is listed under "Compile Sources"

Upvotes: 2

Rui Peres
Rui Peres

Reputation: 25907

You could check if you have the file here:

Targets => Select the target which is the select target your scheme is trying to run => Tab Build Phases => Compile Sources

Check if there is something wrong there (like file in red).

Upvotes: 1

Related Questions