xcode 预期类型错误

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/10427410/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-15 00:10:39  来源:igfitidea点击:

Expected a type error

iosxcodeprotocols

提问by Nikolai Ruhe

So I created this method:

所以我创建了这个方法:

- (void)addToViewController:(SecViewController *)controller 
      didFinishEnteringItem:(NSString *)item;` <br>

And Xcodekeeps giving me Expected a typeerror at SecViewController *. What does that mean? SecViewControlleris not a type?

并且Xcode一直Expected a typeSecViewController *给我错误。这意味着什么?SecViewController不是一个类型?

回答by Nikolai Ruhe

You have to declare SecViewController:

你必须声明SecViewController

@class SecViewController;

... at the top of your header.

...在标题的顶部。

Note: Don't just #importall used headers. This just worsens your header dependencies.

注意:不要只是#import所有使用的标题。这只会恶化您的标头依赖性。