iphone - NSPredicate,NsNumber numberWithFloat :0. 0 (iPhone)

标签 iphone nspredicate nsnumber

嗨,我有带有数字属性的核心数据数据库。它们是 NSNumber。默认值是 0.0,但是当我尝试执行一些 NSPredicated 获取时,我得到“'NSInvalidArgumentException',原因:'无效谓词:nil RHS'”只是因为属性值为 0.0

谓词的创建方式为:

[NSPredicate predicateWithFormat:@"(startValue => %@) AND (endValue <= %@) AND (someId == %@)",startNSNumber,endNSNumber, idString]

我该如何解决这个问题?

最佳答案

您将浮标添加为对象,而不是浮标?试试这个:

[NSPredicate predicateWithFormat:@"(startValue => %f) AND (endValue <= %f) AND (someId == %@)",startNSNumber,endNSNumber, idString];

关于iphone - NSPredicate,NsNumber numberWithFloat :0. 0 (iPhone),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3823762/

相关文章:

ios - 为 NSNumber 值设置精度

iphone - 我想在 iTunes Connect 中将我的通用应用程序更新为仅限 iPad 的应用程序。但是在提交二进制文件时出现以下错误

iphone - 此时如何识别oneTap/doubleTap?

iphone - 带有函数或选择器的 NSPredicate

objective-c - 任何一对多对多谓词

iphone - 为什么 NSNumber 类不能正确地将我的 NSString 对象转换为 long long?

objective-c - 在 CoreData 中设置时 double NSNumber 不准确(使用 RestKit)

iphone - 如何将 iPhone 摄像头拍摄的视频发送到服务器进行直播?

iphone - 选择单元格时 UITableViewCell subview 消失

swift - 我过滤了字典的 NSMutableArray 然后我想再次过滤一个键