无法解析格式字符串

时间:2011-03-07 13:15:32

标签: objective-c core-data

我收到以下错误:无法格式化字符串@"( 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              ]];

1 个答案:

答案 0 :(得分:3)

您的上一个占位符混淆了 - @%而不是%@