How can I disable ARC for a single file in a project?

前端 未结 18 2927
星月不相逢
星月不相逢 2020-11-21 04:31

I am using ARC successfully in my project. However, I have encountered a few files (e.g., in unit tests and mock objects) where the rules of ARC are a little more fragile ri

相关标签:
18条回答
  • 2020-11-21 05:23
    1. Select Xcode project
    2. Go to targets
    3. Select the Build phases section
    4. Inside the build phases section select the compile sources.
    5. Select the file which you do not want to disable ARC and add -fno-objc-arc

    Disable ARC for a particular file

    0 讨论(0)
  • 2020-11-21 05:25

    The four Mandatory Step as explained in this video

        //1. Select desired files
        //2. Target/Build Phases/Compile Sources
        //3. Type -fno-objc-arc
        //4. Done
    
    0 讨论(0)
  • 2020-11-21 05:26

    Please Just follow the screenshot and enter -fno-objc-arc .

    0 讨论(0)
  • 2020-11-21 05:26

    Just use the -fno-objc-arc flag in Build Phases>Compile Sources infront of files to whom you dont want ARC to be apply.

    0 讨论(0)
  • 2020-11-21 05:27

    Disable ARC on MULTIPLE files:

    1. Select desired files at Target/Build Phases/Compile Sources in Xcode
    2. PRESS ENTER
    3. Type -fno-objc-arc
    4. Press Enter or Done

    ;)

    enter image description here

    0 讨论(0)
  • 2020-11-21 05:27

    GO to App -> then Targets -> Build Phases -> Compile Source

    Now, Select the file in which you want to disable ARC

    paste this snippet "-fno-objc-arc" After pasting press ENTER

    in each file where you want to disable ARC.

    0 讨论(0)
提交回复
热议问题