简体   繁体   English

预期类型

[英]Expected a Type

I get an error that says 'Expected a Type' and I have no clue what that means. 我收到一条错误消息“ Expected a Type”,但我不知道这是什么意思。 Here are the lines where the error is: 以下是错误所在的行:

#pragma mark - Flipside View Controller

- (void)flipsideViewControllerDidFinish:(XYZFlipsideViewController*)controller <=== This    
is the line with the error
{
    if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone) {
        [self dismissViewControllerAnimated:YES completion:nil];
    } else {
        [self.flipsidePopoverController dismissPopoverAnimated:YES];
        self.flipsidePopoverController = nil;
    }
}

Generally, this message shows up when you have a structural typo in your file (that messes up the quotes or parenthesis balancing, etc...) 通常,当您的文件中出现结构性错字(弄乱引号或括号平衡等)时,会显示此消息。

This has happened to me before and it was a header file that had a typo in it. 这在我之前发生过,这是一个头文件中有错字。 Did you check XYZFlipsideViewController.h? 您是否检查了XYZFlipsideViewController.h? Check for typos but also circular dependencies. 检查拼写错误以及循环依赖项。

I had the same Problem. 我有同样的问题。 You should look at the elements which don't get highlighted correct, the type of the not highlighted element should be added to your class. 您应该查看未正确突出显示的元素, 未突出显示的元素的类型应添加到您的类中。

In my case, I had a problem with UIColor . 就我而言,我遇到了UIColor问题。 This happens if UIKit.h is not included, so xCode doesn't know how to handle the used classes. 如果不包括UIKit.h则会发生这种情况,因此UIKit.h不知道如何处理使用的类。

In your case, ** XYZFlipsideViewController.h** should be the problem. 在您的情况下,** XYZFlipsideViewController.h **应该是问题所在。 It might be possible you have also to include UIKit.h by adding 您可能还必须通过添加来包含UIKit.h

#import <UIKit/UIKit.h>

If this doesn't fix your problem have a look at other elements and there type and try to include the framework from iOS. 如果这不能解决您的问题,请查看其他元素,然后键入并尝试包括iOS中的framework

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM