What am I doing wrong? My code crashes when I try to log the array. Here is my class:
@interface ArrayTestAppDelegate : NSObject <UIApplicationDelegate> {
UIWindow *window;
NSArray *array;
}
@property (nonatomic, retain) IBOutlet UIWindow *window;
@property (nonatomic, retain) NSArray *array;
-(IBAction)buttonPressed;
@end
@implementation ArrayTestAppDelegate
@synthesize window, array;
- (void)applicationDidFinishLaunching:(UIApplication *)application {
array = [NSArray arrayWithObjects:@"Banana", @"Apple", @"Orange", @"Pear", @"Plum", nil];
[window makeKeyAndVisible];
}
-(IBAction)buttonPressed {
NSLog(@"%@", array);
}
- (void)dealloc {
[window release];
[array release];
[super dealloc];
}
@end