Posts

Post marked as solved
1 Replies
1.9k Views
The com.apple.developer.icloud-container-environment provides the option to set "the development or production environment to use for the iCloud containers." My app uses Core Data, and I have implemented NSPersistentCloudKitContainer. When I am not working on schema changes, I would like my local development builds to still access the production Core Data store. However, setting this entitlement to "Production" has not produced this result... the container is still listed as 'Staging' and I can see in the CloudKit Console that the Development container is being used. Does this entitlement only apply to direct use of CloudKit, and not to NSPersistentCloudKitContainer? If it doesn't apply to the latter, is there another way to direct NSPersistentCloudKitContainer to use the Production container? This is an iOS app though I am beginning work on a macOS version and would like to be able to do this in both environments.
Posted
by babbage.
Last updated
.
Post not yet marked as solved
1 Replies
1.2k Views
I have three core data entity types which are subclasses of a shared parent class, but which do not inherit from a shared parent entity type in Core Data. Let's call the three types businesses, customers, and products. Every entity type has the possibility of many-to-many relationships with each of the other entity types. e.g., a business could have relationships with multiple other businesses, customers, and products. A product could be sold by multiple businesses and have been purchased by multiple customers, and be related to other products. These are Core Data many-to-many relationships. There are two contexts in which I am presenting these entities: as results from a search, and to display the other entities that are in relationship with a specific entity that the user has selected. Currently, I have implemented both of these contexts as being entity-type specific—at any one time you search for products, or businesses, or customers. You change to a different scope within a UISearchBar to swap between entity types. Likewise, when viewing details of a specific entity, you can view lists of the items related to that entity separately for each of the three types. Results are fetched with an NSFetchResultsController in both cases, with an appropriate predicate. Some users have 10,000 entities in total across the categories. Few or none will have 100,000. I want to present collections that instead intermix items from all three of these types in the displayed results or lists. As far as I am aware, this is not possible with an NSFetchedResultsController unless I redesigned my Core Data model to have them all inherit from a base entity type, and that seems to have significant downsides on an ongoing basis, in addition to the necessary complex migration. What is the best way to achieve this? I am open to any technology, any approach, and am willing to raise the required iOS version to iOS 13 or even iOS 14 in order to be able to use the most ideal approach.
Posted
by babbage.
Last updated
.