Hello, I am having trouble with xcode and I am using the IPhone for Dummies as a training guide. I am totally brand new at any programing. I am getting the same errors that indicate undeclared variable in two places. Below is a copy of the program code. The first one is "savedNumberforKey" in the line below the 2nd commented out line begining with //jm. The next is the same error on the line below the "- (void) applicationWillTerminate. Thanks for your patience and any assistance.
import "ReturnMeToAppDelegate.h"
import "ReturnMeToViewController.h"
NSString *kNumberLocationKey = @"NumberLocation";
@implementation ReturnMeToAppDelegate
@synthesize window; @synthesize viewController; @synthesize savedNumber;
pragma mark - UIApplicationDelegate methods
(void)applicationDidFinishLaunching:(UIApplication*) application {
NSString *tempString = [[NSUserDefaults standardUserDefaults]objectForKey:kNumberLocationKey];
//jm self.savedNumber = [[NSUserDefaults standardUserDefaults]objectForKey:kNumberLocationKey]; self.savedNumber = tempString; [tempString release]; if (savedNumber == nil) { NSString *aString = @"517 423 6192"; savedNumber = aString; [aString release]; //jm savedNumber = @"517 423 6192"; NSDictionary *savedNumberDict = [NSDictionary dictionaryWithObject:savedNumberforKey:kNumberLocationKey]; [[NSUserDefaults standardUserDefaults] registerDefaults:savedNumberDict ]; }
[window addSubview:viewController.view]; [window makeKeyAndVisible]; }
(void)applicationWillTerminate:(UIApplication *)application {
[[NSUserDefaults standardUserDefaults] setObject:savedNumberforKey:kNumberLocationKey]; }
// Override point for customization after app launch
(void)dealloc { [viewController release]; [window release]; [savedNumber release]; [kNumberLocationKey release];
[super dealloc]; }
@end