<bdo id='O5brk'></bdo><ul id='O5brk'></ul>
      <tfoot id='O5brk'></tfoot>
      <legend id='O5brk'><style id='O5brk'><dir id='O5brk'><q id='O5brk'></q></dir></style></legend>

    1. <i id='O5brk'><tr id='O5brk'><dt id='O5brk'><q id='O5brk'><span id='O5brk'><b id='O5brk'><form id='O5brk'><ins id='O5brk'></ins><ul id='O5brk'></ul><sub id='O5brk'></sub></form><legend id='O5brk'></legend><bdo id='O5brk'><pre id='O5brk'><center id='O5brk'></center></pre></bdo></b><th id='O5brk'></th></span></q></dt></tr></i><div id='O5brk'><tfoot id='O5brk'></tfoot><dl id='O5brk'><fieldset id='O5brk'></fieldset></dl></div>
    2. <small id='O5brk'></small><noframes id='O5brk'>

      1. 如何在 Xcode 4.2 中启用 ARC 项目范围

        时间:2023-10-03
        • <small id='Yj3cN'></small><noframes id='Yj3cN'>

            <tbody id='Yj3cN'></tbody>
          <i id='Yj3cN'><tr id='Yj3cN'><dt id='Yj3cN'><q id='Yj3cN'><span id='Yj3cN'><b id='Yj3cN'><form id='Yj3cN'><ins id='Yj3cN'></ins><ul id='Yj3cN'></ul><sub id='Yj3cN'></sub></form><legend id='Yj3cN'></legend><bdo id='Yj3cN'><pre id='Yj3cN'><center id='Yj3cN'></center></pre></bdo></b><th id='Yj3cN'></th></span></q></dt></tr></i><div id='Yj3cN'><tfoot id='Yj3cN'></tfoot><dl id='Yj3cN'><fieldset id='Yj3cN'></fieldset></dl></div>
            <tfoot id='Yj3cN'></tfoot>

            • <legend id='Yj3cN'><style id='Yj3cN'><dir id='Yj3cN'><q id='Yj3cN'></q></dir></style></legend>

                • <bdo id='Yj3cN'></bdo><ul id='Yj3cN'></ul>
                  本文介绍了如何在 Xcode 4.2 中启用 ARC 项目范围的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我有一个想要使用 ARC 转换的 iOS 应用.我只会使用迁移工具,但在预览阶段它总是会出错.

                  I have an iOS app that I want to convert to using ARC. I would just use the migration tool, but it errors out for me consistently during the preview phase.

                  我知道我可以逐个文件地使用 -fobjc-arc 编译器指令,但我想在整个项目上启用 ARC,然后使用 -fno-objc-arc 关闭个别类.

                  I know I can use the -fobjc-arc compiler directive on a file-by-file basis, but I want to enable ARC on the entire project, then turn off individual classes using -fno-objc-arc.

                  4.2的新项目默认可以使用ARC,所以一定有什么地方可以切换的.

                  New projects in 4.2 can use ARC by default, so there must be a switch somewhere.

                  谁能帮我把项目转换成ARC

                  推荐答案

                  "ARC 在 Xcode 4.2 中可用,目前处于测试阶段,并且仅在使用 Clang(又名Apple LLVM 编译器")进行编译.设置是显然,它被称为Objective-C 自动引用计数".打开它,然后关闭.

                  "ARC is available in Xcode 4.2, currently in beta, and only when compiling with Clang (a.k.a. "Apple LLVM compiler"). The setting is called, obviously enough, "Objective-C Automatic Reference Counting". Turn it on, and off you go.

                  如果您正在处理现有代码,则更改此设置将产生大量的错误.ARC 不仅为您管理内存,但它禁止你尝试自己做.这是违法的使用 ARC 时手动发送保留/释放/自动释放.由于正常非 ARC 可可代码中到处都是这些东西,你会得到很多错误.

                  If you're working on existing code, changing this setting will produce an enormous quantity of errors. ARC not only manages memory for you, but it forbids you from trying to do it yourself. It's illegal to manually send retain/release/autorelease when using ARC. Since normal non-ARC Cocoa code is littered with this stuff, you'll get a lot of errors.

                  幸运的是,Xcode 提供了一个转换现有代码的工具.选择编辑-> 重构... -> 转换为 Objective-C ARC... Xcode 将指导您完成代码转换.虽然可能有一些在需要帮助的情况下弄清楚该做什么,该过程应该在很大程度上是自动的."

                  Fortunately, Xcode offers a tool to convert existing code. Select Edit -> Refactor... -> Convert to Objective-C ARC... and Xcode will guide you through converting your code. Although there may be some situations where it needs help figuring out what to do, the process should be largely automatic."

                  我从这个链接中得到它,对我帮助很大:http://www.mikeash.com/pyblog/friday-qa-2011-09-30-automatic-reference-counting.html

                  I took that from this link, helped me a lot: http://www.mikeash.com/pyblog/friday-qa-2011-09-30-automatic-reference-counting.html

                  这篇关于如何在 Xcode 4.2 中启用 ARC 项目范围的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:使用 AVVideoCompositionCoreAnimationTool 在 CALayer 中将视频与静态图像混合 下一篇:适用于 iPhone 的 UIPopOverController(目前仅适用于 iPad)

                  相关文章

                • <i id='sJOFS'><tr id='sJOFS'><dt id='sJOFS'><q id='sJOFS'><span id='sJOFS'><b id='sJOFS'><form id='sJOFS'><ins id='sJOFS'></ins><ul id='sJOFS'></ul><sub id='sJOFS'></sub></form><legend id='sJOFS'></legend><bdo id='sJOFS'><pre id='sJOFS'><center id='sJOFS'></center></pre></bdo></b><th id='sJOFS'></th></span></q></dt></tr></i><div id='sJOFS'><tfoot id='sJOFS'></tfoot><dl id='sJOFS'><fieldset id='sJOFS'></fieldset></dl></div>

                  1. <small id='sJOFS'></small><noframes id='sJOFS'>

                  2. <tfoot id='sJOFS'></tfoot>

                      <bdo id='sJOFS'></bdo><ul id='sJOFS'></ul>

                    1. <legend id='sJOFS'><style id='sJOFS'><dir id='sJOFS'><q id='sJOFS'></q></dir></style></legend>