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:
在第一个代码中,它要求我在第一个代码中添加@end来修复它。代码变成这样:
#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!
我不知道到底发生了什么,请帮忙!我在另一个项目中使用了相同的类,效果很好!
4 个解决方案
#1
9
Yes that is from a another header or implementation file already imported beforehand that is missing a @end
是的,这是从另一个头文件或已经导入的实现文件中,这是丢失了一个@end。
It could be a .h or .m file
它可以是。h或。m文件。
#2
0
@end should only come once in a single file.Whats with the top @end.And import all files at the top ?
@end只在单个文件中出现一次。@end是什么?并导入顶部的所有文件?
#3
0
you may have opened a "{" that is never closed with a "}" before the @end line...
您可能已经打开了一个“{”,在@end行之前从未关闭“}”。
so, the error is not at the @end line... but xcode just find out you are missing a "}" or ")"
所以,错误不在@end行…但是xcode只是发现你错过了一个“}”或“)”
#4
-1
Let me show whole file .h and .m file then i can answer well No Problem.
让我显示整个文件。h和。m文件,然后我可以回答没问题。
You need to remove first @end
from .h file and run you will solve the issue.
您需要从.h文件中删除第一个@end,然后运行您将解决这个问题。
Instead of this :
而不是:
#import <UIKit/UIKit.h>
@end
@end
@interface CustomCellArticle: UITableViewCell
@ interface CustomCellArticle:UITableViewCell
@property (strong, nonatomic) IBOutlet UILabel *name;
@property (strong, nonatomic) IBOutlet UILabel *name;
@end
@end
Use this :
用这个:
#import <UIKit/UIKit.h>
@interface CustomCellArticle: UITableViewCell {
@ interface CustomCellArticle:UITableViewCell {
} @property (strong, nonatomic) IBOutlet UILabel *name;
@property(强,非原子)IBOutlet UILabel *name;
@end
@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
.
我也在xcode中检查过。您只需要删除第一个@end。
If this thing is not working you have some another issue.
如果这件事不奏效,你还有另外一个问题。
#1
9
Yes that is from a another header or implementation file already imported beforehand that is missing a @end
是的,这是从另一个头文件或已经导入的实现文件中,这是丢失了一个@end。
It could be a .h or .m file
它可以是。h或。m文件。
#2
0
@end should only come once in a single file.Whats with the top @end.And import all files at the top ?
@end只在单个文件中出现一次。@end是什么?并导入顶部的所有文件?
#3
0
you may have opened a "{" that is never closed with a "}" before the @end line...
您可能已经打开了一个“{”,在@end行之前从未关闭“}”。
so, the error is not at the @end line... but xcode just find out you are missing a "}" or ")"
所以,错误不在@end行…但是xcode只是发现你错过了一个“}”或“)”
#4
-1
Let me show whole file .h and .m file then i can answer well No Problem.
让我显示整个文件。h和。m文件,然后我可以回答没问题。
You need to remove first @end
from .h file and run you will solve the issue.
您需要从.h文件中删除第一个@end,然后运行您将解决这个问题。
Instead of this :
而不是:
#import <UIKit/UIKit.h>
@end
@end
@interface CustomCellArticle: UITableViewCell
@ interface CustomCellArticle:UITableViewCell
@property (strong, nonatomic) IBOutlet UILabel *name;
@property (strong, nonatomic) IBOutlet UILabel *name;
@end
@end
Use this :
用这个:
#import <UIKit/UIKit.h>
@interface CustomCellArticle: UITableViewCell {
@ interface CustomCellArticle:UITableViewCell {
} @property (strong, nonatomic) IBOutlet UILabel *name;
@property(强,非原子)IBOutlet UILabel *name;
@end
@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
.
我也在xcode中检查过。您只需要删除第一个@end。
If this thing is not working you have some another issue.
如果这件事不奏效,你还有另外一个问题。