I have already created a project in XCode 4.2 with ARC checked. The problem is that I have to download and add the ASIHttpRequest files. This is giving a whole bunch of errors when I try to compile. Is there some way to fix this (other than to create a project again) ?
Click on the name of the project on the navigation view in the left side, go to Targets -> Build Phases and add -fno-objc-arc to the "compiler flags" for any relevant files.
You can turn off ARC per-file by passing the flag -fno-objc-arc to each as they are compiled. Add the flag to the files that need ARC disabled in the Compile Sources group under the target in the project navigator.
Another option would be to compile ASIHttpRequest as its own framework that doesn't have ARC enabled and just link against the framework. Speak of, isn't ASIHttpRequest already in a framework? (I've not looked at it in a while)
Keep using ARC, but disable it for the ASIHttpRequest files. This answer should point you in the right direction:
How can I disable ARC for a single file in a project?
Related
This question already has an answer here:
Include non-ARC library in an ARC app?
(1 answer)
Closed 8 years ago.
I am facing one issue while I am adding personal non ARC framework in my ARC project. Many errors are there like ARC forbids Objective-C objects in structs. For this I dont want to opt for this solution: "__unsafe_unretained". I want to know from you all expert people that is there any way so that I can add my non arc framework in ARC enabled project?
First you need to add compiler flags in Xcode ->Targets -> Build Phases -> Compile Sources.
Just double click on the column of the row under compiler flag, here you can select multiple file by using cmd and then can disable the ARC for framework, u need to add the -fno-objc-arc in every perticular file.
Now clean and build the project and run, it'll work fine..
go to your project's target-> build phases->compile sources->file you want to disbale ARC-> double click on file and write -fno-objc-arc
I'm trying to add the Mixpanel SDK to an iOS app that uses ARC. After adding the SDK I get some compile errors related to ARC usage. How can I integrate Mixpanel into a project that uses ARC?
In my personal projects I always manage mempory manually. Perhaps there's some way to tell the compiler this code uses ARC while this code doesn't.
Click on your project name in the navigator. Choose "Build Phases" from the list header in the right hand window. You should see a bar named "Compile Sources"; expand it and you should see a list of the source files in the project and a column labeled "Compiler Flags". For every file in the Mixpanel SDK, double-click in this column and add the following line:
-fno-objc-arc
This will signal the compiler to not use Automatic Reference Counting when compiling these files. If you ever need to do the reverse (compile ARC code in a non-ARC project) do the same thing but add this line instead:
-fobj-arc
I believe this may be a duplicate of this question.
I have a app with the WhiteRaccoon framework installed.
I cant compile it as it gives me errors with anything to do with retain or release in WhiteRaccoon.m/h.
Any ideas whats going on?
Thanks.
By the way, I have added the CFNetwork framework. Any ideas?
Your project is probably using ARC and WhiteRaccoon probably isn't.
You can either convert whiteRaccoon (whatever that is) to ARC or exclude the whiteRaccoon files by adding the following compiler flags to it's source files -fno-objc-arc.
To do that click the project on the left hand side then go to the "Build Phases"-> "Compile Sources" look for the white Raccoon .m files and add the -fno-objc-arc under the compiler flags section.
Another option would be to compile the WhiteRaccoon framework into a static library and as this to your project.
I want to check Internet connection in my app. So i use Apple's Reachability sample code.
But because of using ARC there are some errors. I correct some of them but other errors still in my code.
How should i solve this problems? Any ideas?
Thnx.
You can disable ARC on a per-file basis.
Select the project in the file list
Select the target
Click the Build Phases tab
Open the Compile Sources phase
Scroll down until you find your source file (or use the search field)
Double-click in the Compiler Flags column for that file
Enter -fno-objc-arc
Now ARC is disabled for that one file.
Try using this for your ARC version code -> Reachability (iOS) ARCified
Is there an iOS 5 arc compatible lazy Image loading library? I've not found one.
My next thought is to make EGOlazyloading a compiled library and link it to my project. Would that work? Any pointers on going about?
Thanks!
I wrote one. You can download it here:
https://github.com/nicklockwood/AsyncImageView
Alternatively, if you do want to use EGO, or some other library, select Edit>Refactor>Convert to ARC and in the dialog that comes up there's a little drop down to select which files to convert.
Just tick the files that should be converted to ARC and un-tick ones which shouldn't be. If a file is already using ARC then leave it ticked (it won't double convert it).
That gives you the option of either trying to convert the library files to ARC or to leave them alone. Files that are unticked will be marked with the -fno-objc-arc flag automatically so you won't have to do anything.
Byron, you could just use a regular library like EGOlazyloading you suggested and order the compiler not to use ARC on those specific files by adding the flag -fno-objc-arc in "Build Phases -> Compile Sources"