开发者

Adwhirl is Not working in the UIViewController Class

开发者 https://www.devze.com 2022-12-22 11:42 出处:网络
If i implement it in application delegate class开发者_StackOverflow中文版 then it works fine. But in Viewcontroller class crash every time.

If i implement it in application delegate class开发者_StackOverflow中文版 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


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.


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)];
}


-(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 }. ☺

0

精彩评论

暂无评论...
验证码 换一张
取 消