EXC_BAD_ACCESS我编写了一个 Cocoa 应用程序,当我关闭应用程序窗口时出现错误。我读到这个错误通常意味着内存问题,但我已经ARC mode打开并且不需要关心释放等(xCode 禁止我调用这个函数并自动管理内存)。
错误指向return NSApplicationMain(argc, (const char **)argv);主函数中的行。
这是我的应用程序的代码:
.h 文件:
@interface MainDreamer : NSWindow <NSWindowDelegate>
{
NSTextField *dreamField;
NSTableView *dreamTable;
NSImageView *dreamview;
NSMutableArray *dreamlist;
NSMutableArray *dataset;
}
@property (nonatomic, retain) IBOutlet NSTextField *dreamField;
@property (nonatomic, retain) IBOutlet NSTableView *dreamTable;
@property (nonatomic, retain) IBOutlet NSImageView *dreamview;
@property (nonatomic, retain) IBOutlet NSMutableArray *dreamlist;
@property (nonatomic, retain) IBOutlet NSMutableArray *dataset;
@property (assign) IBOutlet NSWindow *window;
@end
Run Code Online (Sandbox Code Playgroud)
.m 文件:
@implementation MainDreamer
@synthesize window;
@synthesize dataset;
@synthesize …Run Code Online (Sandbox Code Playgroud)