1
空の日付(0/00/0000 00:00:00)を持つすべてのレコードに対してCloudKitを照会する方法がわかりませんそれを行う述語を作る。ここで空の(またはnullなど)日付のNSPredicateを使用してCloudKitを照会します。
は、私が試したもので、関連するエラー:
let predicate = NSPredicate(format: "ready == nil") // <ready != nil>: <nil> is not a function expression
let predicate = NSPredicate(format: "ready == NIL") // <ready == nil>: <nil> is not a function expression
let predicate = NSPredicate(format: "ready != NULL") // <ready != nil>: <nil> is not a function expression
let predicate = NSPredicate(format: "ready == %@", NSNull()) // NSNull not allowed in comparison expression
let predicate = NSPredicate(format: "ready == $NULL") // Unable to parse the format string "ready == $NULL"
let predicate = NSPredicate(format: "ready == $BLANK") // <ready == $BLANK>: <$BLANK> is not a function expression
let blankDate: Date = Date.init()
let predicate = NSPredicate(format: "ready == %@", blankDate as NSDate)
let haveADate = NSPredicate(format: "ready > %@", NSDate.distantPast as NSDate)
let predicate = NSCompoundPredicate(notPredicateWithSubpredicate: haveADate) // Inverting a valid one doesn't work either
これ以上の研究の後、私はこれは不可能だと信じています。受け入れられた回答によると、https://stackoverflow.com/questions/32683691/how-do-i-query-for-nil-values-with-cloudkit-js CloudKitはキー値ストアなので、値が設定されていない場合、キーは存在しません。 – garafajon