5

I have implemented adwhirl in my project. I have implemented it previously in my projects, so I just incorporated it into my current project from my previous.

- (UIViewController *)viewControllerForPresentingModalView {
{
  return self;
}

I had used this in my previous projects..since my window.rootvviewcontroller was self only. But in my current project there are many screens on which I am showing ads, so I have used:

- (UIViewController *)viewControllerForPresentingModalView {
    {
      return return [[(AppDelegate *)[[UIApplication sharedApplication] delegate] window] rootViewController] ;;
    }

The main problem is the program was crashing, and still is. At first everything was okay: iads test ads loaded up, but it crashed rarely. I soon understand it was because of Admob. It crashed rarely because admob ads were not loaded most of the time.

Now searching for these crashes, I came across a point that since I have made the project in Xcode 4.2 rather than my previous projects Xcode 4.0 there were strong attributes in my window and view controller. I removed it.

Now the problem is in simulator it doesn't crash but it crashes in device.

The error is after I have added adview as a subview and it has - (UIViewController *)viewControllerForPresentingModalView went through this function but before adWhirlDidReceiveAd method.

The actual crash is [GADRequestPrivate spamSignals] EXC_BAD_ACCESS.

halfer
  • 19,824
  • 17
  • 99
  • 186
Shubhank
  • 21,721
  • 8
  • 65
  • 83

3 Answers3

1

Below answer has already earned bounty for me :) ..... you can try for your problem...

Link : Getting to the bottom of crash

I found one of the best way to Debug the code for Crash. Follow the link for Debugging technique:

http://www.cocoadev.com/index.pl?DebuggingAutorelease

You need to analyze your Console very carefully to see actually why the Crash occurs. This helped me in almost all of the Code that are without ARC enabled.

halfer
  • 19,824
  • 17
  • 99
  • 186
DShah
  • 9,768
  • 11
  • 71
  • 127
  • i would have known any error of such..it is not about debugging..i have followed the tutorial of adwhirl..and it is loading iAds correctly..but in Admob it crashes with the particular error..so something might be wrong inside the Adwhirl APi only..i was hoping someone might know...this same thing is working correctly in my other app...furthur more ..Admob API implementation file is locked ..so i can't even know what actually happens during the process. – Shubhank Feb 19 '12 at 19:02
  • If you say that in other app its working fine... then it must problem with your coding only... so for that reason only try to use this way... and get the Last Stack trace and analyse the solutions.... best luck – DShah Feb 19 '12 at 19:24
0

I recommend you analyze your project and look for memory leaks and zombies. It seems like you are sending a message to a released object which causes the invalid memory access. The zombies detection cannot be run on the device, but you can run it on the simulator. Take a look at Xcode Instruments - Enable NSZombie Detection? Where is it?

Hope it helps.

Community
  • 1
  • 1
llullulluis
  • 3,472
  • 3
  • 27
  • 30
  • that's the problem.. i would have definitely used zombies.. but it does not run on the device and the crash isn't in the simulator...!.. damn,..my luck :D – Shubhank Feb 10 '12 at 11:21
  • You can run it on the simulator. It will also detect the zombies. The simulator does not crash as it has a lot of memory and does not need to override your zombies memory. The device has much less memory and crashes because the memory your zombies are using gets overridden by other applications, making the invalid access. Please, excuse me for my poor English. – llullulluis Feb 10 '12 at 11:25
0

Even if this happens in proprietary Adwhirl code, you can learn a lot by turning on all the debugging flags as specified, for example, in How to break on __NSAutoreleaseNoPool. This answer discusses lots of debugging flags, not just autorelease pool ones.

Community
  • 1
  • 1
Scott Marks
  • 614
  • 8
  • 17