How do I query for nil values with CloudKit.js?

杀马特。学长 韩版系。学妹 提交于 2019-12-02 06:28:40

I don't think there is any option to query for nil values in CloudKit. Also not from native code. I have tried a lot of predicates, but non seems to work.

You do have to be aware that CloudKit is a key-value store. When a value is nil, then the key won't be there in the record. There is no option to query for non existing keys.

The closest I have come to a good solution was with a predicate with the format "NOT myField => ''" sorry, don't know the format for .js

In the CloudKit CKQuery documentation there is nothing mentioned about nil fields.

In the documentation for NSPredicates there are sample's for nil values.

But it was already clear that CloudKit has implemented only a subset of the possibilities of NSPredicate (see CKQuery class reference)

I think the best way to handle this is by not using/depending on nil values. If you do need to check some nil status, then instead you could add an extra field that would represent that status.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!