3

I sounds like a stupid question, but it seems I cannot release an adMob GADBannerView.

Admob documentation says don't call "release" when using ARC. Needless to say you cannot call release because it's not allowed and generates an error. I tried this:

@property (nonatomic, strong)  GADBannerView *adMobView;

 [adMobView removeFromSuperview];
 adMobView.delegate = nil;
 adMobView = nil;

But nothing happens. It becomes nil but still stays on the screen. It supposed to be a subclassed UIView. At the best I can hide it but it still received ads and obviously stays in the memory.

Any Ideas?

Tibidabo
  • 21,461
  • 5
  • 90
  • 86

1 Answers1

1

Try weak reference

 @property (nonatomic, weak)  GADBannerView *adMobView;

Weak

weak is similar to strong except that it won't increase the reference count by 1. It does not become an owner of that object but just holds a reference to it. If the object's reference count drops to 0, even though you may still be pointing to it here, it will be deallocated from memory.

Refer more here

Community
  • 1
  • 1
Lithu T.V
  • 19,955
  • 12
  • 56
  • 101
  • It is released after assignment, compiler even gives me a warning about it. I think it's not the reference count but AdMob SDK simply does not support ARC. Nilling an object does not remove from the memory, it must be waiting for a release but it's illegal in ARC. – Tibidabo Jul 25 '13 at 06:07