重构函数错误——“并不是这个工作区中的Xcode 3项目中任何目标的构建阶段的一部分,因此不能重构”

时间:2023-01-17 15:50:12

Trying to rename a function's name via the refactor->rename button in a categoriy's .h file in XCode 4.1 I'm getting this error: (error and body)

在XCode 4.1中尝试通过refactor->重命名一个函数的名称。

UINavigationController+ZG.h is not part of the build phase of any targets in the Xcode 3 projects in this workspace and so can’t be refactored.

UINavigationController + ZG。h不是这个工作区中的Xcode 3项目中任何目标的构建阶段的一部分,因此不能重构。

Add the file to the build phase of a target in an Xcode 3 project in this workspace, or make a selection in another file.

将该文件添加到该工作区中的Xcode 3项目中目标的构建阶段,或者在另一个文件中进行选择。

Not sure what it wants and why it's saying something about xcode 3 when i don't have any xcode 3 projects or anything like that.

不知道它想要什么,为什么它说了一些关于xcode 3的东西,当我没有任何xcode 3项目或类似的东西。

7 个解决方案

#1


15  

I had this issue today on a project which don't use workspace at all. I couldn't get why Xcode behave wired. Auto complete worked, but return some really unrelevant results as my FAMILY NAME (?!) for a class I was working on.

我今天在一个完全不使用工作区的项目上遇到了这个问题。我搞不懂为什么Xcode会这么疯狂。自动完成工作,但是返回一些不相关的结果作为我的姓(?!)

I found it to be a bug in Xcode 4.1 under OS X 10.7.1 along side with other issues i had. When I reopen my project, the message was gone, refactoring worked as expected and auto-completing worked as well.

我发现它是Xcode 4.1中OS X 10.7.1下的一个bug,以及我遇到的其他问题。当我重新打开我的项目时,消息就消失了,重构工作正常,自动完成工作也正常。

September 2013 Update: It seems that this bug is happening also on Xcode 5 & 10.8.5.

2013年9月更新:似乎这个bug也发生在Xcode 5 & 10.8.5上。

#2


11  

Restarting Xcode did not fix this for me (although it does normally fix a lot of things). I also didn't like the idea of File >> Save As Workspace. As the workspace should already be in my .xcodeproj file, so I didn't want another one. I found another solution that fixed it for me: Window >> Organiser and then Delete Derived Data for my project. Found it mentioned in this other question.

重新启动Xcode并没有为我修复这个问题(尽管它通常会修复很多东西)。我也不喜欢将>>文件保存为工作区。由于工作区应该已经在我的.xcodeproj文件中,所以我不想再要一个。我找到了另一个解决方案:窗口>>组织者,然后删除我的项目派生数据。在另一个问题中发现了。

#3


7  

I was able to get past this error by choosing File >> Save As Workspace.

我可以通过选择File >> Save作为工作区来克服这个错误。

#4


4  

For me personally it was a combination of things.

对我个人而言,这是一种结合。

  1. Deleted derived data from Organizer > projects. (Didn't work after this step)
  2. 删除主办方>项目的派生数据。(这一步没有成功)
  3. Restarted Xcode. (Worked after this step)
  4. 重启Xcode。(这一步后工作)

#5


1  

I have just run into this issue as well. I found that running:

我也遇到了这个问题。我发现运行:

Product->Clean

产品- >清洁

Fixed the problem, and I can now use refractor again.

修正了问题,现在我可以再次使用折射镜了。

#6


0  

I replaced some dead values in project.xcworkspace (Show Package Contents on your Xcode project file) and the problem went away

我在项目中替换了一些无用的值。xcworkspace(在您的Xcode项目文件中显示包的内容),问题就解决了

#7


0  

Have you ever deleted .xcworkspace in Finder? Although the file will be auto-generated by Xcode again, yet its content will be changed. I think that causes your problem. I saw a post recommends to delete .xcworkspace for the purpose of enhancing build speed. Well, mind the catch.

您是否删除过Finder中的.xcworkspace ?尽管Xcode将再次自动生成该文件,但是它的内容将被更改。我认为这就是你的问题所在。我看到一篇文章建议删除.xcworkspace,以提高构建速度。嗯,思想问题。

#1


15  

I had this issue today on a project which don't use workspace at all. I couldn't get why Xcode behave wired. Auto complete worked, but return some really unrelevant results as my FAMILY NAME (?!) for a class I was working on.

我今天在一个完全不使用工作区的项目上遇到了这个问题。我搞不懂为什么Xcode会这么疯狂。自动完成工作,但是返回一些不相关的结果作为我的姓(?!)

I found it to be a bug in Xcode 4.1 under OS X 10.7.1 along side with other issues i had. When I reopen my project, the message was gone, refactoring worked as expected and auto-completing worked as well.

我发现它是Xcode 4.1中OS X 10.7.1下的一个bug,以及我遇到的其他问题。当我重新打开我的项目时,消息就消失了,重构工作正常,自动完成工作也正常。

September 2013 Update: It seems that this bug is happening also on Xcode 5 & 10.8.5.

2013年9月更新:似乎这个bug也发生在Xcode 5 & 10.8.5上。

#2


11  

Restarting Xcode did not fix this for me (although it does normally fix a lot of things). I also didn't like the idea of File >> Save As Workspace. As the workspace should already be in my .xcodeproj file, so I didn't want another one. I found another solution that fixed it for me: Window >> Organiser and then Delete Derived Data for my project. Found it mentioned in this other question.

重新启动Xcode并没有为我修复这个问题(尽管它通常会修复很多东西)。我也不喜欢将>>文件保存为工作区。由于工作区应该已经在我的.xcodeproj文件中,所以我不想再要一个。我找到了另一个解决方案:窗口>>组织者,然后删除我的项目派生数据。在另一个问题中发现了。

#3


7  

I was able to get past this error by choosing File >> Save As Workspace.

我可以通过选择File >> Save作为工作区来克服这个错误。

#4


4  

For me personally it was a combination of things.

对我个人而言,这是一种结合。

  1. Deleted derived data from Organizer > projects. (Didn't work after this step)
  2. 删除主办方>项目的派生数据。(这一步没有成功)
  3. Restarted Xcode. (Worked after this step)
  4. 重启Xcode。(这一步后工作)

#5


1  

I have just run into this issue as well. I found that running:

我也遇到了这个问题。我发现运行:

Product->Clean

产品- >清洁

Fixed the problem, and I can now use refractor again.

修正了问题,现在我可以再次使用折射镜了。

#6


0  

I replaced some dead values in project.xcworkspace (Show Package Contents on your Xcode project file) and the problem went away

我在项目中替换了一些无用的值。xcworkspace(在您的Xcode项目文件中显示包的内容),问题就解决了

#7


0  

Have you ever deleted .xcworkspace in Finder? Although the file will be auto-generated by Xcode again, yet its content will be changed. I think that causes your problem. I saw a post recommends to delete .xcworkspace for the purpose of enhancing build speed. Well, mind the catch.

您是否删除过Finder中的.xcworkspace ?尽管Xcode将再次自动生成该文件,但是它的内容将被更改。我认为这就是你的问题所在。我看到一篇文章建议删除.xcworkspace,以提高构建速度。嗯,思想问题。