3
我試圖用predicateWithSubstitutionVariables篩選對象的數組,該代碼會拋出異常predicateWithSubstitutionVariables總是拋出異常
NSPredicate *pSample = [NSPredicate predicateWithFormat:@"name CONTAINS [c] $variable"];
[pSample predicateWithSubstitutionVariables:@{@"variable":@"sample string"}];
NSLog(@"%@", [mArray filteredArrayUsingPredicate:pSample]);
例外,我得到:
reason: 'Can't get value for 'variable' in bindings {
}.
爲什麼我不能用這個 ? (我不是在尋找一個替代的解決方案)