我正在尝试获取联系人的家庭电子邮件属性。它工作正常,但我不确定我是否检查我是否正确检查家庭电子邮件属性是否为nil
.
//Since there are multiple email labels, I iterate through them and check which one matches the string "Home" and that is the home email
if([emailLabel isEqualToString:@"Home"]){
//Here is where I check if there is actually a home email value
if ((__bridge_transfer NSString *)ABMultiValueCopyValueAtIndex(emailsMultiValueRef, emailsCount) != NULL){
email = (__bridge_transfer NSString *)ABRecordCopyValue(currentPerson, kABPersonEmailProperty);
}
//If the email property does not exist
else{
email = @"NULL";
}
}
我的问题是:在这一行if ((__bridge_transfer NSString *)ABMultiValueCopyValueAtIndex(emailsMultiValueRef, emailsCount) != NULL)
中,我是否将作为字符串复制的值与nil
or进行比较NULL
?我不确定 nil 值检查当前是否有效。
提前致谢!