Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Interface 2, Advanced iOS
Mockup & Code Gen
($9.99)

Make your own iPhone apps
and run them live!
(free)

Pic Frame Dynamo: Photo Editing
($0.99)

Abiliator
($1.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum > iPhone SDK Development Forums > iPhone SDK Development

Reply
 
LinkBack Thread Tools Display Modes
Old 10-21-2011, 04:49 PM   #1 (permalink)
Registered Member
 
Join Date: Jul 2011
Posts: 5
ankurdhikoli is on a distinguished road
Default ReturnMeToAppDelegate,appDelegate undeclared first use in function

ReturnMeToAppDelegate undeclared first use in function
appDelegate undeclared first use in function


this is the code showing error


ReturnMeToAppDelegate *appDelegate = [[UIApplication sharedApplication] delegate];
ankurdhikoli is offline   Reply With Quote
Old 10-21-2011, 07:35 PM   #2 (permalink)
Registered Member
 
Join Date: Jun 2009
Location: Ypsilanti, Michigan
Age: 63
Posts: 1,549
RLScott is on a distinguished road
Default

Quote:
Originally Posted by ankurdhikoli View Post
ReturnMeToAppDelegate undeclared first use in function
appDelegate undeclared first use in function


this is the code showing error


ReturnMeToAppDelegate *appDelegate = [[UIApplication sharedApplication] delegate];
Normally, ReturnMeToAppDelegate would be defined in a .H file, something like this:

Code:
@interface ReturnMeToAppDelegate : NSObject <UIApplicationDelegate> {...
Do you have such a .H file and is it included or imported into the file that contains the code you posted?
RLScott is offline   Reply With Quote
Old 10-22-2011, 04:00 AM   #3 (permalink)
Registered Member
 
Join Date: Jul 2011
Posts: 5
ankurdhikoli is on a distinguished road
Default

Quote:
Originally Posted by RLScott View Post
Normally, ReturnMeToAppDelegate would be defined in a .H file, something like this:

Code:
@interface ReturnMeToAppDelegate : NSObject <UIApplicationDelegate> {...
Do you have such a .H file and is it included or imported into the file that contains the code you posted?

please tell me how to declare that in .h file i know it should be declared there but dont know how.. i am new to iphone actually copied this code from book..
ankurdhikoli is offline   Reply With Quote
Old 10-22-2011, 05:08 AM   #4 (permalink)
Registered Member
 
Join Date: Jul 2011
Posts: 5
ankurdhikoli is on a distinguished road
Default

Code:
//
//  returntomeAppDelegate.m
//  returntome
//
//  Created by Ankur on 10/13/11.
//  Copyright 2011 __MyCompanyName__. All rights reserved.
//

#import "returntomeAppDelegate.h"
#import "returntomeViewController.h"

NSString *kNumberLocationKey = @"NumberLocation";

@implementation returntomeAppDelegate


@synthesize window;
@synthesize viewController;
@synthesize savedNumber;


#pragma mark -
#pragma mark Application lifecycle

- (void)applicationDidFinishLaunching: (UIApplication *) application {
	
	self.savedNumber = [[NSUserDefaults standardUserDefaults]
						objectForKey:kNumberLocationKey]; 
	if (savedNumber == nil) 
	{
		savedNumber = @"9958232127";
		NSDictionary *savedNumberDict = [NSDictionary
										 dictionaryWithObject:savedNumber
										 forKey:kNumberLocationKey];
		[[NSUserDefaults standardUserDefaults]
		 registerDefaults:savedNumberDict];
	}
	[window addSubview:viewController.view];
	[window makeKeyAndVisible];
}

- (void)applicationWillResignActive:(UIApplication *)application {
    /*
     Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
     Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game.
     */
}


- (void)applicationDidEnterBackground:(UIApplication *)application {
    /*
     Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. 
     If your application supports background execution, called instead of applicationWillTerminate: when the user quits.
     */
}


- (void)applicationWillEnterForeground:(UIApplication *)application {
    /*
     Called as part of  transition from the background to the inactive state: here you can undo many of the changes made on entering the background.
     */
}


- (void)applicationDidBecomeActive:(UIApplication *)application {
    /*
     Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
     */
}


- (void)applicationWillTerminate:(UIApplication *)application {
    /*
     Called when the application is about to terminate.
     See also applicationDidEnterBackground:.
     */
	[[NSUserDefaults standardUserDefaults]
	 setObject:savedNumber forKey:kNumberLocationKey];
}


#pragma mark -
#pragma mark Memory management

- (void)applicationDidReceiveMemoryWarning:(UIApplication *)application {
    /*
     Free up as much memory as possible by purging cached data objects that can be recreated (or reloaded from disk) later.
     */
}


- (void)dealloc {
    [viewController release];
    [window release];
    [super dealloc];
}


@end



//
//  returntomeAppDelegate.h
//  returntome
//
//  Created by Ankur on 10/13/11.
//  Copyright 2011 __MyCompanyName__. All rights reserved.
//

#import <UIKit/UIKit.h>

@class returntomeViewController;

@interface returntomeAppDelegate: NSObject <UIApplicationDelegate>
{
    UIWindow *window;
    returntomeViewController *viewController;
	NSString *savedNumber;
}

@property (nonatomic, retain) IBOutlet UIWindow *window;
@property (nonatomic, retain) IBOutlet returntomeViewController *viewController;
@property (nonatomic,retain) NSString *savedNumber; 
@end
ankurdhikoli is offline   Reply With Quote
Reply

Bookmarks

Tags
xcode 3.2

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



» Advertisements
» Online Users: 392
14 members and 378 guests
13dario13, 7twenty7, buggen, EvilElf, glenn_sayers, j.b.rajesh@gmail.com, LunarMoon, morterbaher, n00b, QuantumDoja, sacha1996, Sami Gh, VinceYuan
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,673
Threads: 94,122
Posts: 402,906
Top Poster: BrianSlick (7,990)
Welcome to our newest member, morterbaher
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 05:27 AM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0