refactor function error - “is not part of the buil

2019-04-18 04:45发布

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)

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.

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.

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.

7条回答
Emotional °昔
2楼-- · 2019-04-18 05:21

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.

查看更多
仙女界的扛把子
3楼-- · 2019-04-18 05:25

For me personally it was a combination of things.

  1. Deleted derived data from Organizer > projects. (Didn't work after this step)
  2. Restarted Xcode. (Worked after this step)
查看更多
Emotional °昔
4楼-- · 2019-04-18 05:29

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

查看更多
等我变得足够好
5楼-- · 2019-04-18 05:32

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.

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.

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

查看更多
唯我独甜
6楼-- · 2019-04-18 05:33

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.

查看更多
Summer. ? 凉城
7楼-- · 2019-04-18 05:36

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

查看更多
登录 后发表回答