我收到以下错误:无法格式化字符串@"( StudiesPatient.PatientName LIKE %@ AND ModalityName LIKE %@ AND StudiesPatient.PatientID LIKE @% )"
我使用下面的代码,任何建议如何解决它
]]; */
PatientName = (PatientName != @"")? PatientName : @"*" ;
Modality = (Modality != @"" )? Modality : @"*" ;
PataientID = (PataientID != @"") ? PataientID : @"*" ;
NSLog(PatientName ) ;
NSLog( Modality) ;
NSLog( PataientID) ;
[fetchRequest setPredicate:[NSPredicate predicateWithFormat:@"( StudiesPatient.PatientName LIKE %@ AND ModalityName LIKE %@ AND StudiesPatient.PatientID LIKE @% )",
PatientName,
Modality,
PataientID ]];
答案 0 :(得分:3)
您的上一个占位符混淆了 - @%
而不是%@
。