lavelle
lavelle

Reputation: 1546

Synthesize property errors when compiling iPhone app

I am following the tutotial on Apple's website for building your first iPhone application, as this is a field i would like to be involved in.

I completed the app, but then decided to merge it with another app. (One simply changes an image when tapped, one displays text from a text box when a button is tapped, so not too tricky to combine)

I have copied most of the code over successfully, but somewhere i have gone wrong as 6 times i get the error

@synthesize property must be in implementation context

for the 6 things i am synthesizing.

I feel like i have copied everything over, and i have checked all instances of the synthesized items so they are definitely there, so i dont know why this is occurring.

When i put the lines that are causing errors in an implemeation cointext (i.e between @implemtation and @end), i get

no declaration of property 'X' found in the interface

where x is the name of the thing i am synthesizing.

How do i put it in the interface? it seemed like i had already linked all the Interface Builder components to the relevant bits of code.

Upvotes: 3

Views: 700

Answers (2)

bemshaswing
bemshaswing

Reputation: 11

@synthesize property must be in implementation context

implies that you're not properly placing it between @implementation and @end. Can you post your .m file

Upvotes: 1

Henrik P. Hessel
Henrik P. Hessel

Reputation: 36617

You have to declare a property in your interface

@interface CustomAlertViewController : UIViewController {
    UIView  *alertView;
    UILabel *label;
}
@property (nonatomic, retain) IBOutlet UIView *alertView; <--- Property
@property (nonatomic, retain) IBOutlet UILabel *label;    <--- Property

Upvotes: 0

Related Questions