3

Tried to convert an iOS app using AdWhirl to ARC (Automatic Reference Counting). There are several autorelease calls within AdWhirlView.m that ARC forbids.

When I refactored all my paid apps (that didn't have adwhirl) to ARC, XCode just removed my retains, releases, and autoreleases for me, but something about the way the code in AdWhirlView.m is written has caused XCode to pause, noting "[rewriter] it is not safe to remove an unused 'autorelease' message; its receiver may be destroyed immediately."

Is anybody able to rewrite AdWhirlView.m to work correctly with ARC? Or will I be forced to avoid combining the two? =/

Thanks in advance!

RanLearns
  • 4,086
  • 5
  • 44
  • 81
  • What's stopping you from removing the autoreleases and fixing it yourself? – Jasarien Nov 08 '11 at 21:27
  • 1
    You can also just add `-fno-objc-arc` to the compiler flags for that specific file (see the Build Phase area of the target build settings). – Lily Ballard Nov 08 '11 at 21:30
  • When I refactored all my paid apps (that didn't have adwhirl) to ARC, XCode just removed my retains, releases, and autoreleases for me, but something about the way the code in AdWhirlView.m is written has caused XCode to pause, noting "[rewriter] it is not safe to remove an unused 'autorelease' message; its receiver may be destroyed immediately." Obviously I am using AdWhirl instead of writing my own class to serve ads within my app, I rely on AdWhirl to do that job but I don't know how to fix their code – RanLearns Nov 08 '11 at 21:34
  • @ObjectiveFlash that's the kind of information that should be included in your question. – Jasarien Nov 08 '11 at 21:37
  • you're right! sorry about that - I usually try to be pretty complete in my questions – RanLearns Nov 08 '11 at 21:57

1 Answers1

4

Alright, I've found the way around this...

When you click "Convert to Objective-C ARC" it brings up a menu called "Select Targets to Convert"

All you have to do is expand the list of files by clicking on the drop-down arrow, then deselect all the AdWhirl files.

XCode will convert the rest of your project to ARC without hitting on an error when it gets to the AdWhirl files.

RanLearns
  • 4,086
  • 5
  • 44
  • 81
  • 1
    XCode will then automatically add the "-fno-objc-arc" that Kevin posted as a comment above to all the files that you deselected – RanLearns Nov 10 '11 at 19:02