开发者

Core Data NSPredicate casting key value

开发者 https://www.devze.com 2023-04-08 15:25 出处:网络
I have a data model which has values of type id that I was planning on开发者_C百科 casting appropriately when needed.

I have a data model which has values of type id that I was planning on开发者_C百科 casting appropriately when needed.

Is it possible for me to cast these as strings and compare them to strings from a UISearchBar using NSPredicate or do I have to use another method?

Maybe something like this:

NSPredicate * predicate;
    predicate = [NSPredicate predicateWithFormat:@"CAST(%K) contains[cd] %@", employeeID , theSearchBar.text];


No. The CAST() function doesn't work that way. I think you just have to assume that the id returned from -employeeID is comparable to a string.

0

精彩评论

暂无评论...
验证码 换一张
取 消