Xcode 4.4无法重命名类/变量 [英] Xcode 4.4 unable to rename classes/variables

查看:123
本文介绍了Xcode 4.4无法重命名类/变量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Xcode 4.4和4.4.1上,我都遇到相同的问题,因为我正在处理的特定项目似乎无法从Refactor菜单重命名任何类或变量.选项.

On both Xcode 4.4 and 4.4.1 I'm experiencing the same issue in that with the specific project I'm working on, I don't seem to be able to rename any classes or variables from the Refactor menu option.

每次尝试进行重命名时,我都会为类/变量键入新名称,然后单击Preview,此时左下角将以Finding files...开始微调.但是,我随后收到一条消息:

Each time I try and do a rename, I type in the new name for the class/variable and click Preview at which point the bottom left begins a spinner with Finding files.... However, I then get a message saying:

选择不是可以重命名的类型.

The selection is not a type that can be renamed.

进行其他选择,然后重试.

Make a different selection and try again.

我非常确定这不是我的特定Xcode安装问题,因为我可以很好地重构其他项目,只是我似乎无法重构该特定项目.

I'm pretty sure that this is not an issue with my specific install of Xcode, because I can refactor other projects fine, it's just that I can't seem to be able to refactor this specific project.

有人有什么想法吗?对于这个项目,我没有任何特别的配置,这似乎只是一个随机的折磨.我已经删除了所有派生数据并重新建立了索引,但这似乎无济于事.

Anyone with any ideas? I don't have any particularly exotic configuration for this project, it just seems to be a random affliction. I've deleted all of my derived data and re-indexed, but that doesn't seem to help.

由于它在其他项目中可以正常工作,所以我想我可以尝试做的一件事就是重新生成实际的项目文件本身.我不知道是否可以自动执行此操作吗?

Since it works OK in other projects, I'm thinking one thing I could try to do is re-generate the actual project file(s) itself. I don't know if there is a way to do this automatically?

推荐答案

在尝试了许多不同的东西(调整项目设置,pch等)之后,我设法解决了这个问题,结果发现这非常简单(并且解决此问题的方法完全是违反直觉的.

I have managed to solve this issue after trying many different things (tweaking project settings, pch, etc.) and it turns out there was a very simple (and totally counter-intuitive) method of fixing this issue.

我所要做的是:-

  1. 复制我的整个项目文件夹(因此从Project复制到Project Copy).
  2. Project(原始文件夹)移至垃圾箱.
  3. Project Copy重命名为Project.
  1. Copy my entire project folder (so from Project to Project Copy).
  2. Move Project (the original folder) to trash.
  3. Rename Project Copy to Project.

神奇的是,现在一切正常.

Mysteriously, everything now works fine.

我真的不知道为什么这样做.如前所述,我已经删除了所有派生数据,等等.所以我不知道为什么这会使事情自发地起作用,但是确实如此.

I really cannot figure out why this works. As mentioned previously, I had already deleted all derived data, etc. so I don't know why this should make things spontaneously work, but it does.

将感谢能够在此方面有所作为的任何人,因为它确实揭示了Xcode的精巧之处,并且任何了解幕后的事物总是有益的.

Would appreciate anyone who is able to shed some light on this as it does expose just how fiddly Xcode can be, and any understanding of what goes on under the hood is always beneficial.

这篇关于Xcode 4.4无法重命名类/变量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆