Manoj Khaylia
Manoj Khaylia

Reputation: 1

Adwhirl is Not working in the UIViewController Class

If i implement it in application delegate class then it works fine. But in Viewcontroller class crash every time. i implemented try-catch then it will not crash. but not working.

Thanks Manoj

Upvotes: 0

Views: 469

Answers (3)

Peter Hosey
Peter Hosey

Reputation: 96333

-(void)awakeFromNib{
    adWhirlView = [AdWhirlView requestAdWhirlViewWithDelegate:self];

Since you're assigning this object's pointer into one of your instance variables, you should retain the object. See the memory management rules.

Also, terminate the method with a }. ☺

Upvotes: 0

Amit Battan
Amit Battan

Reputation: 325

This is my code if we comment the line [mainMenuView addSubview:adWhirlView]; then Application works ok

my .h file

#import "AdWhirlDelegateProtocol.h"
@interface Are_you_BoredViewController : UIViewController  <AdWhirlDelegate> {
    AdWhirlView *adWhirlView;]

my .m file

-(void)awakeFromNib{
    adWhirlView = [AdWhirlView requestAdWhirlViewWithDelegate:self];

-(void)nextButtonEnable{
        [menuLoop stop];
        [splashActIndicator stopAnimating];
        [splashActIndicator setHidesWhenStopped:YES];
        [nextSplashBtn setHidden:NO];
        [self.view addSubview:mainMenuView];
        [mainMenuView addSubview:adWhirlView];
        [mainMenuView setFrame:CGRectMake(0.0, 0.0, 320.0, 480.0)];
}

Upvotes: 0

Nikolai Ruhe
Nikolai Ruhe

Reputation: 81868

Learn to use the debugger.

It’ll tell you, where the crash happens. Then you might get an idea about which object or which method is to blame. Your case sounds like a memory management problem, but it’s impossible to tell from your description.

Also: try-catch is a concept rarely used in Cocoa. If you come from Java, you’ll might think that is catches all errors, but in Objective-C, few errors throw exceptions.

Upvotes: 2

Related Questions