Ios xcode需要objective-c方法的选择器,缺少@end错误
这是我的密码Ios xcode需要objective-c方法的选择器,缺少@end错误,ios,objective-c,Ios,Objective C,这是我的密码 #import "MasterViewController.h" #import "DiseaseResultsViewController.h" @interface MasterViewController () @end @implementation MasterViewController @synthesize symptomTextField; - (void)viewDidLoad { [super viewDidLoad]; // Do a
#import "MasterViewController.h"
#import "DiseaseResultsViewController.h"
@interface MasterViewController ()
@end
@implementation MasterViewController
@synthesize symptomTextField;
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
}
- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
if ([[segue identifier] isEqualToString:@"searchFunctionSegue"])
{
if ([self.symptomTextField.text length])
{
DiseaseResultsViewController *resultsViewController = [segue destinationViewController];
resultsViewController.symptomSearchString = self.symptomTextField.text;
}
}
}
@end
我在屏幕上看到一个“Objective-C方法的预期选择器”错误
“如果([self.symportextfield.text length])行
“DiseaseResultsViewController*resultsViewController=[segue destinationViewController]”行下方的行中出现“预期的方法体”和“缺少@end”错误
我已经检查了所有导入文件的@end是否正确
有什么想法吗?这是我见过的最令人沮丧和愚蠢的错误之一。我只是剪切并粘贴回代码中,错误消失了:S我也有同样的错误,我错误地编写了“+”登录
.m
文件
查找代码半小时后,我
删除“+”
符号,错误消失。在我的情况下,错误报告在.h:
但问题在于。m:
有一个输入错误,我错误地输入了a+。我相信你和我一样也很沮丧。在我的例子中,我删除了“@end”“而这正是导致错误的原因。再添加一次,错误就会消失。别紧张 在我的例子中,它在方法声明中使用了明显保留的关键字“connect”。更改为“-(void)initConnect;”为我解决了它。什么是
SympleTextField
?@属性(强,非原子)IBOutlet UITextField*SympleTextField;我觉得上面列出的代码很好。包含的两个.h文件之一是否有问题?#import
@interface MasterViewController:UIViewController
@property(弱、非原子)IBOutlet UITextField*症状textfield
@end
#import@interface DiseaseResultsViewController:UITableViewController@property(非原子,强)NSString*症状搜索字符串@结束
我简直不敢相信自己的眼睛,但这也对我起了作用。用相同代码的剪切粘贴消除了8个错误。一定是代码解析器中的错误。我不敢相信我做了同样的事情,我的也是+我也有同样的问题。正如其他人的遭遇所证明的那样,这种情况的发生频率令人怀疑。