Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Objective C: "Property implementation must have its declaration in interface"

Tags:

objective-c

I have the following code:

//RootViewController.h:

#import <UIKit/UIKit.h>

@interface RootViewController : UIViewController{
    IBOutlet UITextField *login_uname;
    IBOutlet UITextField *login_pword;
    IBOutlet UIActivityIndicatorView *login_thinger;
    IBOutlet UIImageView *logo;
    IBOutlet UISwitch *login_remember;

    IBOutlet UIScrollView *scrollView;
}




-(IBAction) login_submitClick:(id)sender;
-(IBAction) doneEditing:(id)sender;
-(IBAction) clearPword:(id)sender;
-(void) showSignUp:(id)sender;

-(void)doLogout:(id)sender;

//for file handling:
-(NSString *)documentsPath;
-(NSString *)readFromFile:(NSString *)filePath;
-(void) writeToFile:(NSString *)text withFileName:(NSString *) filePath;

@end

//RootViewController.m

#import "RootViewController.h"
//#import "Main.h"
//#import "SignUp.h"
#import "ASIHTTPRequest.h"
#import "ASIFormDataRequest.h"
#import "CommonCrypto/CommonHMAC.h"
#import "Details.h"
//#import "signUpSMS.h"
#import "JSON.h"

@implementation PrestoCab3ViewController
@synthesize login_uname;   //this line throws the error in the title

...

I'm using XCode 4.1 and was wondering if someone could please help me get to the bottom of this error. I'm very new to XCode.

Many thanks in advance,

like image 554
Eamorr Avatar asked Sep 14 '11 16:09

Eamorr


1 Answers

You need to declare the property with @property in your interface.

@property( nonatomic, retain ) IBOutlet UITextField * login_uname;

Here, non-atomic is used because it's an IBOutlet. Also note the property has the retain modifier, meaning you are responsible to release the object when you don't need it anymore.

like image 53
Macmade Avatar answered Sep 19 '22 02:09

Macmade