非常简单的错误,但无论我做什么来纠正它,它都行不通。这来自我的DetailViewController.m:
-(void)performPhoneAction:(BOOL)shouldMakeCall{
if (![[_dictContactDetails objectForKey:@"mobileNumber"] isEqualToString:@""]
![[_dictContactDetails objectForKey:@"homeNumber"] isEqualToString:@""]) {
UIActionSheet *phoneOptions = [[UIActionSheet alloc] initWithTitle:@"Pick a number"
delegate:self
cancelButtonTitle:@"Cancel"
destructiveButtonTitle:@""
otherButtonTitles:[_dictContactDetails objectForKey:@"mobileNumber"], [_dictContactDetails objectForKey:@"homeNumber"], nil];
它给了我“@homeNumber”行的错误。我的括号是否正确到位或是否在某个地方陷入困境?
答案 0 :(得分:1)
在你的if语句中,你没有任何连接条件,例如&&或||:
if (![[_dictContactDetails objectForKey:@"mobileNumber"] isEqualToString:@""] &&
![[_dictContactDetails objectForKey:@"homeNumber"] isEqualToString:@""]) {