0

Well, the subject pretty much says it all. I have code to unzip and parse an epub. It works fine if I don't use ARC, but I get a EXC_BAD_ACCESS if I use the same code (without the retains and deallocs of course) with ARC enabled.

The code bombs during the parse method of the NSXML parser.

The code I am running is: http://ideveloperworld.blogspot.in/2011/02/epub-reader.html

You might be thinking, why not just proceed without ARC then, but I am integrating the epub reader into a much larger project that already uses ARC.

Thanks for any help.

Jomnipotent17
  • 451
  • 7
  • 23
  • 1
    You can compile individual translation units with ARC turned off. It may be better just to do that for this portion of your project. – Jason Coco Jul 03 '12 at 05:02

1 Answers1

0

If you want some files to be compiled without arc, here's what you need to do.

go to your project (click on the blue folder in the Project Navigator), then go to build phases. Click Compile Sources, which should be a list of files in your project.

For any files that you want to be compiled WITHOUT ARC, Set a Compiler Flag for that file to be: "-fno-objc-arc". It should look like this:enter image description here

bkbeachlabs
  • 2,121
  • 1
  • 22
  • 33
  • okay. I will try this now. I was thinking about this problem and it seems that if ARC causes a EXC_BAD_ACCESS it is deallocing an object that otherwise wouldn't be dealloced. Which makes me think the code is leaking an object normally. – Jomnipotent17 Jul 03 '12 at 05:19
  • Okay, I did what you said. It works. It still bothers me that it doesn't work with ARC because of my comment above, but this will work for my needs. Thank you very much. – Jomnipotent17 Jul 03 '12 at 05:27
  • Try making the offending object a property. You may be doing womething wrong with the visiblity of an object or variable in a loop or something, but if you make it a declared property, you dont really have any issues with scope – bkbeachlabs Jul 03 '12 at 05:28
  • ok great. My comment might help you avoid this fix. I admit it is kind of a band-aid solution to just avoid using ARC in the first place – bkbeachlabs Jul 03 '12 at 05:29