-->

How do I get a list of RecordTypes in a Database?

2019-09-09 19:56发布

问题:

I want to list all records in a Database.

To do this using CKQuery, it appears I must have a recordType. The predicate will be TRUEPREDICATE.

How can I get a list of RecordTypes, for eventual use within CKQuery? (e.g. I'll loop through the list, and create new CKQuery objects at run time.)

回答1:

As strange as it may seem, there is no way to determine what record types exist in a Cloud Kit database. Your code should be creating records with specific record types so your code should already know what records types there are.

If you are creating records with dynamic record types, then you should keep your own list of used record types. This should probably me maintained using yet another, but known, record type.