gpt4 book ai didi

ios - iOS-预期字符不合理

转载 作者:行者123 更新时间:2023-12-01 19:01:43 25 4
gpt4 key购买 nike

在为iPhone编写应用程序时,我的Xcode编译器出现奇怪的错误。我得到的错误是:
Expected ']'

- (IBAction)backButton:(id)sender
{
NSUserDefaults* standardUserDefaults = [NSUserDefaults standardUserDefaults];
if(standardUserDefaults)
{
NSString* isNewNote = [standardUserDefaults objectForKey:@"newNote"]; // here is the error
if(isNewNote isEqualToString:@"Yes")
{
[noteList removeObjectAtIndex:currentNote];
[noteContent removeObjectAtIndex:currentNote];
}
}

NSString* storyboardName = @"Main";
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"Main" bundle: nil];
UIViewController * vc = [storyboard instantiateViewControllerWithIdentifier:@"ViewController"];
[self presentViewController:vc animated:NO completion:nil];
}

你能找出什么问题吗?谢谢。

最佳答案

这个:

if(isNewNote isEqualToString:@"Yes")

应该是这样的:
if([isNewNote isEqualToString:@"Yes"])

关于ios - iOS-预期字符不合理,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22392444/

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