iOS-预期字符不合理

山姆

在为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"])

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章