如何在项目之间添加ARC

时间:2013-03-18 11:47:43

标签: ios objective-c ios6 automatic-ref-counting

我正在创建iPhone应用程序,在此之间我需要使用SDWebImage。为此,我需要使用ARC。

知道如何在项目之间添加ARC吗?

注意:在一个文件中,我有以下内容。

#if !__has_feature(objc_arc)
#error SDWebImage is ARC only. Either turn on ARC for the project or use -fobjc-arc flag
#endif

我应该在哪里添加-fobjc-arc标志?

6 个答案:

答案 0 :(得分:3)

Select Project Form Project Manager
  |
  | 
  Targets
       |
       |
     Build Phases
          |
          |
        Compile Sources
                |
                |
            Select File that you Want to crate as ARC. (You can also Select Multiple File name from here)
                        |
                        |
                    Press "ENTER" key
                           |
                           |
                      Popup Box/Window is displayed 
                               |
                               |
                            Write here - '-fno-objc-arc'
                                    |
                                    |
                                And again Press 'ENTER' key.

Your selected file is being ARC.

答案 1 :(得分:1)

Change from build settings

Project->Build setting->Objective-C Automatic Reference Counting  SET YES

If you need to remove ARC then Go to  Project->Build Phases->compile sources then find your file Which you need to remove ARC then set compile source '-fno-objc-arc' 

答案 2 :(得分:1)

如果您使用的是xcode 4.6,请选择目标Target - > Build Settings并找到 Apple LLVM编译器4.2 ,如果目标-c,请参阅本节自动参考计数设置为,如果没有,则将其设置为YES。对于旧版本的XCode,您可以更改Apple LLVM compiler 3.0

答案 3 :(得分:0)

在xcode之上

edit-> refactor->然后选择convert to Arc

答案 4 :(得分:0)

试试这个look into the image as shown add -fobjc-arc flag flag-

希望这能解决你的问题。

答案 5 :(得分:0)

编辑→重构→转换为Objective-C ARC。

以下是有关如何处理任何迁移问题的文档:

http://developer.apple.com/library/mac/#releasenotes/ObjectiveC/RN-TransitioningToARC/Introduction/Introduction.html

相关问题