如何使用Xcode提取重构功能? [英] How to use Xcode Extract refactoring feature?

查看:90
本文介绍了如何使用Xcode提取重构功能?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何使用Xcode的 提取 重构工具?

How do you use Xcode's Extract refactoring tool?

无论选择什么代码,我总能得到相同的无益错误消息。

Whatever code I select, I always get the same unhelpful error message.


所选内容不包含任何可以提取的内容。进行
的其他选择,然后重试。

The selection does not contain anything that can be extracted. Make a different selection and try again.

请参见以下屏幕截图:

See the screenshots below:

要使其正常工作,我需要遵循什么条件?

What do I need to follow to have it work?

我是在一个简单的iOS项目中执行此操作,没什么特别的,没有C ++。尝试使用最新版本的Xcode(4.4)和更新的最新开发人员预览版。

I am doing this on a simple iOS project, nothing special, no C++. Tried with the latest version of Xcode (4.4) and the newer latest developer preview releases.

这是一个错误吗?有解决方法吗?

Is this a bug? Any workaround?

推荐答案

由于某些奇怪的原因,如果您的代码块没有创建明显的拾取参数返回值XCode抱怨是否包含换行符。我认为这是一个错误,因为应该忽略空格。只要确保您不包含换行符即可。例如,以下与重构>提取方法一起使用:

For some strange reason if you have a block that doesn't create an obvious return value of pick up parameters XCode complains if you include the newlines. In my opinion this is a bug, as whitespace should be ignore. Just make sure you don't include the newlines. For example, the following works with "Refactor > Extract Method":

这篇关于如何使用Xcode提取重构功能?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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