Posts

Post not yet marked as solved
2 Replies
1.5k Views
I have implemented NSCoreDataCoreSpotlightDelegate, and I missed out the part where the default expirationDate is 1 month, now items that I have added 3 months ago are not showing up in the search index.How do I get NSCoreDataCoreSpotlightDelegate to reindex all the items?I used to be able to call this:mcdcsd.searchableIndex(CSSearchableIndex.default(), reindexAllSearchableItemsWithAcknowledgementHandler: {})And the first time, it will reindex all the items, but if I re-run the app with the above line uncommented again, it will not reindex.If I uninstall the app, install back, then uncomment the above line, then it will index all again for the first time.How do I get it to reindex everything again?
Posted
by ykphuah.
Last updated
.
Post not yet marked as solved
3 Replies
1k Views
I am using NSPersistentCloudKitContainer, and have a many-to-one optional relationship, let say many "item" to one "project".This relationship is optional, so I can do this ->item.project = nilwhen the user decided that this item does not belongs to any project.This code is fine in Core Data, and the inverse relationships are updated accordingly.However, once this gets synced to CloudKit, and come back down, the "project relationship" will be restored. Setting the project to other entities are fine, it just cannot be set to "nil".Playing with the CloudKit dashboard, I realized that the schema that is created have a CD_Project as String. If I create a new item without any project, there's no such field, however, once I assign a project to an item, the field is set, and there is no way to unset this field, even from the CloudKit Dashboard. I naively tried to clear out the string in cloudkit dashboard but it crashes my app when the sync happens.Is this a bug that will be fixed? The issue is also posted by another developer here:https://stackoverflow.com/questions/57470636/relationship-persistence-with-nspersistentcloudkitcontainerI have a few workaround ideas but they all require extra work, and seems to confuse readers of the code in the future:1. change it to many-to-many instead2. have a special project that means "No Project"3. have a field in item named "projectIsNil"
Posted
by ykphuah.
Last updated
.