线程1:程序接收信号:“SIGABRT”

时间:2011-07-03 17:42:23

标签: iphone objective-c cocoa-touch

我正在尝试使用View切换和WebView构建一个简单的应用程序 它一直有效,直到我写了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

1 个答案:

答案 0 :(得分:1)

您没有创建视图。

-(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]; 

} 

此外,您需要在dealloc中发布webView。你应该对属性感到满意。

尝试在僵尸的帮助下捕获错误:NSZombieEnabled