Xcode/Objective-C 中预期说明符限定符列表是什么意思?

发布于 2024-11-03 02:21:07 字数 254 浏览 1 评论 0原文

我不断收到此错误: Expected specifier-qualifier-list before '(' token, on this 2 line:

@property (nonatomic, retain) (@Implementation window, hvController;

-(void)dealloc ;@property (nonatomic, retain){

PS 删除 ( 只会使问题变得更糟

I keep getting this error: Expected specifier-qualifier-list before '(' token, on these 2 lines:

@property (nonatomic, retain) (@Implementation window, hvController;

-(void)dealloc ;@property (nonatomic, retain){

P.S. removing the ( only makes the problem worse

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

握住你手 2024-11-10 02:21:07

这有点像火车失事,但我看到你是新人(就像我们都曾经一样),所以我会尝试&提供更多帮助...

出现更多错误并不意味着您的问题更糟。您只是看不到新的错误,因为旧的错误挡住了您的视线。所以杀掉那个讨厌的“(”。

@property可能最好放在你的头文件中,但无论如何它后面应该跟着你想要成为属性的东西的类型和名称,并且你也需要一个@synthesize 然后

您的代码应该看起来更像这样(在您的 .h 文件中的某个位置)...

@property (nonatomic, retain) IBOutlet UIWindow *window;
@property (nonatomic, retain) IBOutlet UIViewController *hvController;

然后(在您的 .m 文件中的某个位置)...

@Implementation YourClassName
@synthesize window, hvController;

(稍后在您的 .m 文件中)...

 - (Void)dealloc {
     [hvController release];
     [window release];
     [super dealloc];
 }

..有很多介于两者之间的其他东西

......但是请获取一本书或一些在线教程并从更简单的东西开始!

This is a bit of a train wreck, but I see you're new (as we all were once) so I'll try & be a bit more helpful...

Getting more errors doesn't mean your problems are worse. You just couldn't see the new errors because the old one was in the way. So Kill that pesky '('.

The @property is probably better off in your header file, but anyway it should be followed by the type and name of the thing you want to be a property, and you need a @synthesize for it too.

Your code should look more like this (somewhere in your .h file)...

@property (nonatomic, retain) IBOutlet UIWindow *window;
@property (nonatomic, retain) IBOutlet UIViewController *hvController;

and then (somewhere in your .m file)...

@Implementation YourClassName
@synthesize window, hvController;

and then (later in your .m file)...

 - (Void)dealloc {
     [hvController release];
     [window release];
     [super dealloc];
 }

..with lots of other stuff in-between.

...but please get a book or some online tutorials and start with something simpler!

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文