Mr. Smith
Mr. Smith

Reputation: 4516

XCode 4.5.2 The selection is not a type that can be renamed

Renaming variables/classes seems to be broken for me. XCode 4.5.2 brings up a menu asking me what I'd like to rename the variable to, I enter a name and hit preview, and then another screen shows up which brings up the message "The selection is not a type that can be renamed.".

I've tried deleting derived data (via command line, and also via the organizer), it didn't fix it. Anyone found a solution yet? There's been a couple people who've ran into this on older versions of XCode, but they said it was fixed on newer versions (yet I'm using the latest version).

Upvotes: 5

Views: 2234

Answers (3)

John Martin
John Martin

Reputation: 1502

I've just spent about an hour trying to get refactoring working again on Xcode 5.0.1 after it spontaneously stopped working for no apparent reason.

I'm not sure what step actually fixed it because it seemed Xcode was keeping certain processes running even when I was quitting it, so it actually started working after a reboot of the machine, but these are the steps I took:

  • Quit Xcode
  • Deleted ~/Library/Developer/Xcode/DerivedData
  • Deleted .xcodeproj/project.xcworkspace/xcuserdata
  • Deleted .xcodeproj/xcuserdata/.xcuserdatad
  • Reboot
  • Restart Xcode
  • Product -> Clean Build Folder

After that, refactoring seemed to spring back into life. Deleting the xcuserdata did mean that Xcode lost some of my layout settings, etc but having a working refactor tool was more useful!

Upvotes: 3

Szuwar_Jr
Szuwar_Jr

Reputation: 713

I had this error when I was selecting class name in *.m file. In my case, solution was to do this in *.h file.

Upvotes: 0

Zen
Zen

Reputation: 3117

Dont know your problem but when i try previewing, the split screen view or more like the assistant editor view of xcode (where .h and .m file can be viewed simultaneously) with the instances of variable-to-be-renamed can be seen with the old name and the new name. It might be bugged in your case. Is it same in all the projects or just a few of them?

Upvotes: 0

Related Questions