objective-c - 程序在Ipad程序中收到信号sigabrt

标签 objective-c ios cocoa-touch ipad presentmodalviewcontroller

我修复了所有警告,现在我的 AppDelegate 类中有这样的错误

.h文件是

#import <UIKit/UIKit.h>

@interface UYLAppDelegate : UIResponder <UIApplicationDelegate>{

}

@property (retain, nonatomic) IBOutlet UIWindow *window;
@property (retain, nonatomic) IBOutlet UISplitViewController *splitViewController;

@end

.m文件是

#import "UYLAppDelegate.h"
#import "UYLMasterViewController.h"
#import "UYLDetailViewController.h"
#import <QuartzCore/QuartzCore.h>

@implementation UYLAppDelegate

@synthesize window = _window;
@synthesize splitViewController = _splitViewController;

- (void)dealloc
{
    [_window release];
    [_splitViewController release];
    [super dealloc];
}

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
    UIView *rootView = [[self.splitViewController.viewControllers objectAtIndex:0] view];
    rootView.layer.borderWidth = 1.0f;
    rootView.layer.cornerRadius =5.0f;
    rootView.layer.shadowOpacity = 0.8f;
    rootView.layer.shadowOffset = CGSizeMake(-5, 0);

    self.window.rootViewController = self.splitViewController; //error here
    [self.window makeKeyAndVisible];
    return YES;
}

@end

这一行我记错了

self.window.rootViewController = self.splitViewController; //error here

SplitViewController由2个 Controller 组成,.h文件是:

#import <UIKit/UIKit.h>

@class UYLDetailViewController;

@interface UYLMasterViewController : UITableViewController

@property (retain, nonatomic) IBOutlet UYLDetailViewController *detailViewController;

@end

第二个

#import <UIKit/UIKit.h>
#import "UYLModalViewController.h"

@class UYLMasterViewController;

@interface UYLDetailViewController : UIViewController <UYLModalViewControllerDelegate>{
    UIBarButtonItem *_MessageButton;
    NSInteger modalViewShowType;
}

-(IBAction)buttonTapped:(id)sender;

@property (retain, nonatomic, getter=_MessageButton) IBOutlet UIBarButtonItem *someMessageButton;
@property (retain, nonatomic) NSNumber *detailItem;
@property (retain, nonatomic) IBOutlet UIToolbar *toolbar;
@property (retain, nonatomic) IBOutlet UILabel *detailTitle;
@property (retain, nonatomic) IBOutlet UILabel *detailDescriptionLabel;
@property (assign, nonatomic) BOOL masterIsVisible;

@end

编辑: 我在控制台中看到了所有内容

GNU gdb 6.3.50-20050815 (Apple version gdb-1708) (Mon Aug 15 16:03:10 UTC 2011)
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "x86_64-apple-darwin".sharedlibrary apply-load-rules all
Attaching to process 8217.
Pending breakpoint 1 - ""UYLDetailViewController.m":117" resolved
Pending breakpoint 2 - ""UYLModalViewController.m":30" resolved
Pending breakpoint 3 - ""UYLModalViewController.m":41" resolved
Pending breakpoint 4 - ""UYLDetailViewController.m":63" resolved
Pending breakpoint 5 - ""UYLMasterViewController.m":46" resolved
Pending breakpoint 7 - ""UYLDetailViewController.m":36" resolved
No breakpoint number 7.
Current language:  auto; currently objective-c

请帮助我理解它 =(

最佳答案

大多数时候我都有一些SIGABRT错误,这只是意味着它找不到你所指的那个实例。因此,再次查看该行并思考可能未声明为正确的内容。

我认为如果您将其更改为可能会有所帮助。 self.window.rootViewController = splitViewController;

关于objective-c - 程序在Ipad程序中收到信号sigabrt,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8864544/

相关文章:

ios - 'SecRandomCopyBytes' 的冲突类型

ios - 在iOS 6中获取真实的Twitter用户名

ios - 在 iOS 中检查设备屏幕打开或关闭

ios - 链接多个 Alamofire 请求

ios - 在新的 iOS 应用程序版本上处理推送通知

ios - 出现键盘时移动 UIView

ios - Swift IOS 使用 AVFoundation 录制视频和音频

ios - addOperationWithBlock 的操作顺序

iOS - 约束在 viewdidload 中以意想不到的方式动画?

ios - 切换到 xcode 6 后,viewDidLayoutSubviews 被无限调用