开发者

Thread 1: Programm received signal: "SIGABRT"

Im trying开发者_运维知识库 to build an easy application with View swiching and UIWebView it worked till i wrote the UIWebView

-(IBAction)pushButton { 

    TermineViewController *screen = [[TermineViewController alloc] initWithNibName:nil bundle:nil]; 
    screen.modalTransitionStyle = UIModalTransitionStyleCrossDissolve; 
    [self presentModalViewController:screen animated:YES]; thread 1: program receved signal: "SIGaBRT"
    [screen release]; 
}

-(IBAction)pushButton2 {

    SpeiseplanViewController *screen = [[SpeiseplanViewController alloc] initWithNibName:nil bundle:nil];
    screen.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;
    [self presentModalViewController:screen animated:YES];
    [screen release];




//
//  TermineViewController.m
//  LhAppv3
//
//  Created by joan on 03.07.11.
//  Copyright 2011 __MyCompanyName__. All rights reserved.
//

#import "TermineViewController.h"


@implementation TermineViewController

-(IBAction)pushBack {

    [self dismissModalViewControllerAnimated:YES];

}

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        // Custom initialization
    }
    return self;
}

- (void)dealloc
{
    [super dealloc];
}

- (void)didReceiveMemoryWarning
{
    // Releases the view if it doesn't have a superview.
    [super didReceiveMemoryWarning];

    // Release any cached data, images, etc that aren't in use.
}

#pragma mark - View lifecycle

/* 
 // Implement viewDidLoad to do additional setup after loading the view, typically from a nib. 
 - (void)viewDidLoad 
 { 
 [super viewDidLoad]; 
 } 
 */ 

-(void)viewDidLoad { 

    [super viewDidLoad]; 
    [webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:@"http://www.landheim-schondorf.de/news/"]]]; 
    [NSTimer scheduledTimerWithTimeInterval:1.0 target:self selector:@selector(checkLoad) userInfo:nil repeats:YES]; 
    [NSTimer scheduledTimerWithTimeInterval:1.0 target:self selector:@selector(checkNotLoad) userInfo:nil repeats:YES]; 

} 

-(void)checkLoad { 

    if(webView.loading) { 
        [active startAnimating]; 

    } 

} 

-(void)ckeckNotLoad { 

    if(!(webView.loading)) { 
        [active stopAnimating]; 

    } 

} - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
    // Return YES for supported orientations
    return (interfaceOrientation == UIInterfaceOrientationPortrait);
}

@end


//
//  TermineViewController.h
//  LhAppv3
//
//  Created by joan on 03.07.11.
//  Copyright 2011 __MyCompanyName__. All rights reserved.
//

#import <UIKit/UIKit.h>


@interface TermineViewController : UIViewController {

    IBOutlet UIWebView *webView;
    IBOutlet UIActivityIndicatorView *active;
}

-(IBAction)pushBack;

@end


You are not creating a view.

-(void)viewDidLoad { 
    [super viewDidLoad]; 
    webView = [[UIWebView alloc] initWithFrame:aRect]; //<--------
    [webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:@"http://www.landheim-schondorf.de/news/"]]]; 
    [NSTimer scheduledTimerWithTimeInterval:1.0 target:self selector:@selector(checkLoad) userInfo:nil repeats:YES]; 
    [NSTimer scheduledTimerWithTimeInterval:1.0 target:self selector:@selector(checkNotLoad) userInfo:nil repeats:YES]; 

} 

Additionally you need to release webView in dealloc. And you should get confortable with properties.

Try to catch the bug with the help of zombies: NSZombieEnabled

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜