1


I am currently experiencing an issue with ARC in Xcode6: I have disabled ARC in the Build Settings of my project, however I am getting some errors in my test files, which appear to be complaining about ARC even if I disabled it.
The error messages state: "autorelease is unavailable: not available in automatic reference counting"

Does any of you have any idea why?
When I imported some external libraries, I linked them to both my project and its test files, could that be the issue?

Screenshot

squarefrog
  • 4,750
  • 4
  • 35
  • 64
andlon10
  • 55
  • 5
  • You've probably only disabled ARC for your application target. Make sure that your tests target also has ARC disabled. – Guy Kogus Dec 08 '14 at 10:47
  • I think this is the issue, but being a novice IOS developer, I don't really know how to disable ARC for the test target...Could you suggest a way to achieve that? Thanks!! – andlon10 Dec 08 '14 at 10:57

1 Answers1

0

You can mark files as non-arc on a class by class basis by adding -fno-objc-arc in Compile Sources of your Build Phase. This answer should help you achieve that.

Community
  • 1
  • 1
squarefrog
  • 4,750
  • 4
  • 35
  • 64
  • Hi, thanks for your answer, but I already did that, for all the files. That's why it's such a strange behaviour... – andlon10 Dec 08 '14 at 10:55
  • you don't need to add your project files to the test target - the test target runs inside your main project. I can't imagine this is why you're getting an error. Try a project clean and rebuild. – squarefrog Dec 08 '14 at 10:57
  • Sorry, I didn't explain my issue properly: I believe the error is related to me importing some external libraries and linking them to the test targets as well. Given that cleaning the build doesn't work, do you know if there is a way to unlink those libs from the test target or I should just remove them all and delete their references so I can add them again (without linking them to the tests)? Thanks for your help – andlon10 Dec 08 '14 at 11:04
  • You can remove them from your tests by choosing your Target the going to Build Phases and removing anything that is not one of your test files. It may be easier for you to remove the libs and re add them. A dependancy manager like CocoaPods or Carthage may help you here. – squarefrog Dec 08 '14 at 11:08
  • Ok, none of the solutions worked so I just removed all references and added them again, luckily it's not a big project. It would be great to find the right answer for future reference, but anyway thanks a lot for your help... – andlon10 Dec 08 '14 at 11:27