gpt4 book ai didi

ios - objective-c 方法的 xcode 预期选择器和 Missing @end 错误

转载 作者:可可西里 更新时间:2023-11-01 04:04:44 24 4
gpt4 key购买 nike

这是我的代码

#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

我在"if ([self.symptomTextField.text length]) 行

在“DiseaseResultsViewController *resultsViewController = [segue destinationViewController]”行下方的行中出现“预期方法主体”和“缺少@end”错误

而且我已经检查了我所有导入的文件的@end 是否正确。

有什么想法吗?

最佳答案

在我的例子中,错误是在 .h 中报告的:

enter image description here

但问题出在 .m:

enter image description here

有一个错字,我错误地输入了一个 +。

关于ios - objective-c 方法的 xcode 预期选择器和 Missing @end 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19200307/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com