iOS ViewController SIGABRT

时间:2013-02-28 21:08:29

标签: ios uiviewcontroller ipad sigabrt

我遇到了一个小问题,我从一小时后就无法解决......我是iOS的新手,所以可能是你会在一秒钟之后注意到的事情;)我在SO上寻找类似的帖子,但没有找到满意的答案...

上面有一个SplitViewController(我在左边添加了一个tableView,在右边添加了使用XIB的textView)。当我试图编译并运行我的项目时,我遇到以下错误:

  

线程1:编程收到信号“SIGABRT”。

我想有一个关联tableView和textView的拆分视图。我做错了什么?

SplitViewController.h:

#import <UIKit/UIKit.h>

@interface SplitViewController : UIViewController
@property (weak, nonatomic) IBOutlet UITableView *tableView;
@property (weak, nonatomic) IBOutlet UITextView *textView;

@end

SplitViewController.m:

#import "SplitViewController.h"

@implementation SplitViewController
@synthesize tableView;
@synthesize textView;

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

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

- (void)viewDidLoad
{
    [super viewDidLoad];
    // Do any additional setup after loading the view from its nib.
}

- (void)viewDidUnload
{
    [self setTableView:nil];
    [self setTextView:nil];
    [super viewDidUnload];
    // Release any retained subviews of the main view.
    // e.g. self.myOutlet = nil;
}

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

@end

TestAppDelegate.h:

#import <UIKit/UIKit.h>
@class SplitViewContoller;
@interface TestAppDelegate : UIResponder <UIApplicationDelegate>
@property (strong, nonatomic) UIWindow *window;
@property (strong, nonatomic) UIViewController *viewController;
@end

TestAppDelegate.m:

#import "TestAppDelegate.h"
#import "SplitViewController.h"

@implementation TestAppDelegate
@synthesize window = _window;
@synthesize viewController = _viewController;

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
    self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];

    // Override point for customization after application launch.
    self.viewController = [[SplitViewController alloc] initWithNibName:@"SplitViewController" bundle:nil];
    self.window.rootViewController = self.viewController;
    [self.window makeKeyAndVisible];
    return YES;
}

- (void)applicationWillResignActive:(UIApplication *)application
{
}
- (void)applicationDidEnterBackground:(UIApplication *)application
{
} 
- (void)applicationWillEnterForeground:(UIApplication *)application
{
}   
- (void)applicationDidBecomeActive:(UIApplication *)application
{
}
- (void)applicationWillTerminate:(UIApplication *)application
{
}

@end

和主要的准确性:

#import <UIKit/UIKit.h>

#import "TestAppDelegate.h"

int main(int argc, char *argv[])
{
    @autoreleasepool {
        return UIApplicationMain(argc, argv, nil, NSStringFromClass([TestAppDelegate class]));
    }
}

0 个答案:

没有答案