core-data

Which API is the replacement for Core Data with iCloud

筅森魡賤 提交于 2021-01-27 05:33:57
问题 Update, June 2016: As of the most recent documentation for NSPersistentStoreCoordinator, everything related to Core Data with iCloud is marked as deprecated. As a result it should probably be avoided for new development. Using Core Data, iCloud and CloudKit for syncing and backup and how it works together Important The use of iCloud with Core Data has been deprecated and is no longer being supported. About using iCloud with Core Data I've been reading about integrating iCloud with Core Data.

Deleting Relationship Objects with Cascade in Core Data

荒凉一梦 提交于 2021-01-27 05:16:48
问题 I'm looking to perform some simple deletion with Core data but just need a bit of advice on this one please. I have a model with Transaction, Name, Event and Date Entities. The Transaction has a link to each of the other Entities. In the app, when a user adds in information to text fields, that gets saved to a 4 tab table view controller. The first tab is using NSFetchedResultController with a fetchRequest on the Transaction Entity. The second tab is using the Name Entity, the third is using

How can I get only unique record in coredata+cloudkit(NSPersistentCloudKitContainer) environment?

扶醉桌前 提交于 2021-01-24 20:27:11
问题 For example, I have a entity named User in public database of Cloukit. Every new user using the App will record his identity in it, and only one record. But in coredata+cloudkit environment, there is a user, two apple devices, two this Apps, one cloud. Firstly, the user use this App on the phone A, check existence of User in local coredata when startup, not exist, so create a User record. It's ok. Days later, the user do the same on the second Phone B, record not exist in local(not sync from

How can I get only unique record in coredata+cloudkit(NSPersistentCloudKitContainer) environment?

断了今生、忘了曾经 提交于 2021-01-24 20:25:10
问题 For example, I have a entity named User in public database of Cloukit. Every new user using the App will record his identity in it, and only one record. But in coredata+cloudkit environment, there is a user, two apple devices, two this Apps, one cloud. Firstly, the user use this App on the phone A, check existence of User in local coredata when startup, not exist, so create a User record. It's ok. Days later, the user do the same on the second Phone B, record not exist in local(not sync from

How can I get only unique record in coredata+cloudkit(NSPersistentCloudKitContainer) environment?

时光怂恿深爱的人放手 提交于 2021-01-24 20:18:10
问题 For example, I have a entity named User in public database of Cloukit. Every new user using the App will record his identity in it, and only one record. But in coredata+cloudkit environment, there is a user, two apple devices, two this Apps, one cloud. Firstly, the user use this App on the phone A, check existence of User in local coredata when startup, not exist, so create a User record. It's ok. Days later, the user do the same on the second Phone B, record not exist in local(not sync from

CoreData+CloudKit | On/off iCloud sync toggle

六眼飞鱼酱① 提交于 2021-01-20 20:27:39
问题 I want to give the user the option to toggle iCloud sync on and off. After researching for a while, I saw that one way one could achieve this is by setting the cloudKitContainerOptions . So I would set it to nil if I don't want my database to be synched. if(!UserDefaultsManager.shared.iCloudSyncOn) { description.cloudKitContainerOptions = nil } That's all working fine, but I haven't found a way to do that during runtime. I have tried to reinitialize my container when the user toggles, so that

fetch coredata with one to many relationship in swift

假如想象 提交于 2021-01-19 08:26:29
问题 I have a tableview(table1) of a coredata entity that shows a row of users, and another tableview(table2) that shows another entity that connected with (table1) entity in one to many relationship the (table2)shows up when tap in (table1) selected row, my question is how to show the data on (table2) for the user in selected row from (table1) an example code: let fetchdata:NSFetchRequest<entity2> = entity2.fetchRequest() do { userList = try myContext.fetch(fetchdata) [of entity1 object] }catch{

case insensitive NSPredicate with single result in CoreData

隐身守侯 提交于 2021-01-16 12:29:35
问题 Here is my current NSPredicate: NSPredicate *predicate = [NSPredicate predicateWithFormat:@"UPC==%@ OR ItemID==%@", aUPCCode,aUPCCode]; How can I make this case insensitive? And I do not want to do any partial matching. Example if they enter 123 for aUPCCode I do not want to get 123, 123a, 123b, 123c, ect. I would only want an exact match. I thought about doing this but it seems a little ridiculous: NSPredicate *predicate = [NSPredicate predicateWithFormat:@"UPC==%@ OR ItemID==%@ OR UPC==%@

case insensitive NSPredicate with single result in CoreData

只谈情不闲聊 提交于 2021-01-16 12:28:13
问题 Here is my current NSPredicate: NSPredicate *predicate = [NSPredicate predicateWithFormat:@"UPC==%@ OR ItemID==%@", aUPCCode,aUPCCode]; How can I make this case insensitive? And I do not want to do any partial matching. Example if they enter 123 for aUPCCode I do not want to get 123, 123a, 123b, 123c, ect. I would only want an exact match. I thought about doing this but it seems a little ridiculous: NSPredicate *predicate = [NSPredicate predicateWithFormat:@"UPC==%@ OR ItemID==%@ OR UPC==%@

case insensitive NSPredicate with single result in CoreData

五迷三道 提交于 2021-01-16 12:27:07
问题 Here is my current NSPredicate: NSPredicate *predicate = [NSPredicate predicateWithFormat:@"UPC==%@ OR ItemID==%@", aUPCCode,aUPCCode]; How can I make this case insensitive? And I do not want to do any partial matching. Example if they enter 123 for aUPCCode I do not want to get 123, 123a, 123b, 123c, ect. I would only want an exact match. I thought about doing this but it seems a little ridiculous: NSPredicate *predicate = [NSPredicate predicateWithFormat:@"UPC==%@ OR ItemID==%@ OR UPC==%@