在爲iPhone做應用程序時,我在Xcode編譯器中出現了一個奇怪的錯誤。我得到的錯誤是:iOS - 期待不合理的字符
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];
}
你能弄清楚什麼是錯?謝謝。
'如果(isNewNote isEqualToString:@ 「是」)' - 沒有Xcode的告訴你哪一行的錯誤是嗎? – Douglas
是的。 'NSString * isNewNote = [standardUserDefaults objectForKey:@「newNote」]; //這裏是錯誤' – Sam