In xcode 4.3.1, target iPad 5.1 simulator
- create a single view app
use ARC, don't use Storyboard
in ViewController.h
#import <UIKit/UIKit.h> @interface ViewController : UIViewController { NSObject *anObject; NSObject *anotherObject; } -(void) makeObjects; @endin ViewController.m add
-(void) makeObjects{ anObject = [[NSObject alloc] init]; anotherObject = [[NSObject alloc] init]; int a = 1; }in AppDelegate.m add a line
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions: (NSDictionary *)launchOptions { self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; // Override point for customization after application launch. self.viewController = [[ViewController alloc] initWithNibName:@"ViewController" bundle:nil]; self.window.rootViewController = self.viewController; [self.viewController makeObjects]; // ADD THIS LINE <-------- [self.window makeKeyAndVisible]; return YES; }in ViewController.m, set a breakpoint at
anObject = [[NSObject alloc] init];run
- step over breakpoint
- anObject = 0x00000000, anotherObject is set!