我在尝试Parse Issue
我的XCode项目时遇到Expected Statement
archive
错误。我没有收到此错误,当我定期构建它而不是存档时,应用程序运行正常。
-(void)viewWillAppear:(BOOL)animated {
[super viewWillAppear:animated];
self.navigationController.navigationBarHidden = YES;
if ([[[NSUserDefaults standardUserDefaults] objectForKey:SavedUsername] length] && [[[NSUserDefaults standardUserDefaults] objectForKey:SavedPassword] length]) {
[self.btnRememberMe setSelected:YES];
self.isButtonSelected = YES;
self.txtFieldUsername.text = [[NSUserDefaults standardUserDefaults] objectForKey:SavedUsername];
self.txtFieldPassword.text = [[NSUserDefaults standardUserDefaults] objectForKey:SavedPassword];
// NSLog(@"username = %@ , pass = %@",[[NSUserDefaults standardUserDefaults] objectForKey:SavedUsername], [[NSUserDefaults standardUserDefaults] objectForKey:SavedPassword]);
if ([self isAllFieldVerified])
#ifdef DEBUG
NSLog(@"all fields are verified");
#endif
//[self makeWebAPICallMethodCalling];
}else {
[self.btnRememberMe setSelected:NO];
self.isButtonSelected = YES;
self.txtFieldUsername.text = @"";
self.txtFieldPassword.text = @"";
}
}
else
行...
答案 0 :(得分:2)
问题是#ifdef
语句的NSLog
。当您进行非调试构建时,NSLog
行不会留下没有代码的if
语句。
试试这个:
#ifdef DEBUG
if ([self isAllFieldVerified])
NSLog(@"all fields are verified");
#endif
或者至少添加花括号:
if ([self isAllFieldVerified]) {
#ifdef DEBUG
NSLog(@"all fields are verified");
#endif
}
这就是为什么使用花括号总是一个好主意的例子,即使只有一行。