【问题标题】:error: missing @end error: expected identifier or错误:缺少@end 错误:预期标识符或
【发布时间】:2012-11-21 20:52:47
【问题描述】:

我知道有类似的问题,但我仍然无法解决。

   error: missing @end [1]
    error: expected identifier or '(' [1]
    error: expected a type [1]

(在头文件中获取)

我用新的同名空文件替换了这个文件 - 仍然出现这个错误?

#import "Storage.h"

@implementation Storage

@end


#import <Foundation/Foundation.h>

@interface Storage : NSObject


@end

【问题讨论】:

  • 向我们展示您提到的头文件(以及其他代码,如果需要)

标签: objective-c ios


【解决方案1】:

【讨论】:

  • 你是对的,我在其他类中缺少@tag,但 f-g xcode 调试器将其指向不同的类。
  • 它在第一次遇到意外输入的地方报告错误。在这种情况下,它恰好在下一个标题中。最好将“缺少@end”解释为“哎呀,我真的认为我应该在此之前看到一个@end。”
【解决方案2】:

您是在导入 .m 文件而不是 .h 吗?

像这样,显然是错误的,但自动补全很容易发生

#import "myHeader.m"

【讨论】:

  • 这不是答案,而是猜测。将此作为对问题的评论。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2017-06-25
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2022-07-06
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多