使用XCode 5.0.2将问题从非ARC迁移到ARC

时间:2013-12-12 12:16:46

标签: ios iphone refactoring automatic-ref-counting xcode5

我听说过ARC,我也在XCode 4.2中使用它,但现在有一天我需要将非ARC代码转换为ARC格式。我已经按照一些步骤将我的代码转换为ARC格式,但不知怎的,我没有取得成功。

我按照以下步骤将代码转换为ARC:

1. “Preferences” -> “General” -> check “continue building after error”.   This step is fundamental to avoid an huge waste of time repeating the next steps every time an error is encountered!
2. “Edit” -> “Refactor” -> “Convert to Objective-C ARC”
3. “Select targets to convert” (check them)
4. Click “precheck” – “Cannot Convert to Objective-C ARC” (Xcode found N issues that prevent conversion from proceeding. Fix all ARC readiness issues and try again.)  You will see this message at least once, because your code contains calls that are forbidden by ARC.
5. Fix them using suggestions (click on errors to open the popup containing the tip). Then repeat from step 1.
6. “Convert to automatic reference counting” window will appear (once issues have been fixed)
7. Click next
8. Review automatic changes

关于@property和@synthesize,我的项目的所有HEADER文件仍然出错。我必须手动完成所有HEADER文件中的所有更改,而不是通过自动执行上述步骤来实现。

请帮助我,如果你有任何适当的解决方案,请告诉我。

谢谢,

Nilesh M. Prajapati

1 个答案:

答案 0 :(得分:1)

XCode无法自动修复这些错误。所以你必须先手动修复它们才能继续。