saly
saly

Reputation: 39

Missing '@end' // @end must appear in an objective-c context

This is my code:

 #import <UIKit/UIKit.h>
   @interface CustomCellArticle: UITableViewCell
   @property(nonatomic,retain) IBOutlet UILabel *name;
   @end

In first time I received this error:

Missing @end
Expected identifier or '('

in the first of the code, and it required me to add @end in the first to fix it. the code became like this:

 #import <UIKit/UIKit.h>
   @end //here the seconde error
   @interface CustomCellArticle: UITableViewCell
   @property(nonatomic,retain) IBOutlet UILabel *name;
   @end

When I add it, I received a new error:

@end must appear in an Objective-C context

I don't know what's happened exactly, please help! I used the same class in another project and it works fine!

Upvotes: 1

Views: 6747

Answers (4)

Nirav Jain
Nirav Jain

Reputation: 5107

Let me show whole file .h and .m file then i can answer well No Problem.

You need to remove first @end from .h file and run you will solve the issue.

Instead of this :

#import <UIKit/UIKit.h>

@end

@interface CustomCellArticle: UITableViewCell

@property (strong, nonatomic) IBOutlet UILabel *name;

@end

Use this :

#import <UIKit/UIKit.h>

@interface CustomCellArticle: UITableViewCell {

} @property (strong, nonatomic) IBOutlet UILabel *name;

@end

May this will help you. This is working fine for me.

I have checked also in xcode. You Just need to remove first @end.

If this thing is not working you have some another issue.

Upvotes: -1

meronix
meronix

Reputation: 6176

you may have opened a "{" that is never closed with a "}" before the @end line...

so, the error is not at the @end line... but xcode just find out you are missing a "}" or ")"

Upvotes: 0

zzzzz
zzzzz

Reputation: 1239

@end should only come once in a single file.Whats with the top @end.And import all files at the top ?

Upvotes: 0

robhayward
robhayward

Reputation: 392

Yes that is from a another header or implementation file already imported beforehand that is missing a @end

It could be a .h or .m file

Upvotes: 11

Related Questions