开发者

Core Data NSPredicate casting key value

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜