core-data

Are NSPersistentDocument and UIManagedDocument compatible?

心已入冬 提交于 2020-05-13 07:13:50
问题 I would like to create a NSPersistentDocument in Mac OS X and read this document as a UIManagedDocument on iOS 7. Is this possible? Are both file formats compatible? Thank you! 回答1: Interesting question - I can confirm that the basic core data files are compatible. I have a Mac app and an iOS app using the same file that gets synced using iCloud. The app is a document based app and currently I have been storing the actual database file in iCloud so the whole file gets sync'ed by iCloud. This

Are NSPersistentDocument and UIManagedDocument compatible?

三世轮回 提交于 2020-05-13 07:13:05
问题 I would like to create a NSPersistentDocument in Mac OS X and read this document as a UIManagedDocument on iOS 7. Is this possible? Are both file formats compatible? Thank you! 回答1: Interesting question - I can confirm that the basic core data files are compatible. I have a Mac app and an iOS app using the same file that gets synced using iCloud. The app is a document based app and currently I have been storing the actual database file in iCloud so the whole file gets sync'ed by iCloud. This

Coredata is very slow; swift

吃可爱长大的小学妹 提交于 2020-05-13 04:22:10
问题 i've made an iOS App tracking the gps route of the device. The problem is, that coredata needs very long to save, when i am tracking more than 5 min. I save an object called session and session have much location objects. the location object is [ [latitude, longitude] ] and the session object looks like [name: string, date: nsdate, average speed: double, high speed: double, driven kilometers: double, locations: [ [double, double] ] ] so... it works, but after 5 min. it takes i think 2 or 3

NSArrayController initialization

你。 提交于 2020-05-09 19:52:26
问题 I am having trouble getting an core-data backed NSArrayController to work properly in my code. Below is my code: pageArrayController = [[NSArrayController alloc] initWithContent:nil]; [pageArrayController setManagedObjectContext:[self managedObjectContext]]; [pageArrayController setEntityName:@"Page"]; [pageArrayController setAvoidsEmptySelection:YES]; [pageArrayController setPreservesSelection:YES]; [pageArrayController setSelectsInsertedObjects:YES]; [pageArrayController

Transformable attribute in Core Data not export/sync with iCloud

不打扰是莪最后的温柔 提交于 2020-05-09 07:08:04
问题 I am using NSPersistentCloudKitContainer . All data sync in iCloud. And when uninstalled the app, its sync correctly. However, it's required to encrypt sensitive data. I made my password attribute Transformable. Thus work fine locally. However when I delete the app. Install again. All other attributes(String, Int) sync correctly but transformable attribute does not export/synced. Here is my Model public class EmployeeEntity: NSManagedObject { @NSManaged public var password: NSObject?

Transformable attribute in Core Data not export/sync with iCloud

心已入冬 提交于 2020-05-09 07:07:44
问题 I am using NSPersistentCloudKitContainer . All data sync in iCloud. And when uninstalled the app, its sync correctly. However, it's required to encrypt sensitive data. I made my password attribute Transformable. Thus work fine locally. However when I delete the app. Install again. All other attributes(String, Int) sync correctly but transformable attribute does not export/synced. Here is my Model public class EmployeeEntity: NSManagedObject { @NSManaged public var password: NSObject?

Transformable attribute in Core Data not export/sync with iCloud

安稳与你 提交于 2020-05-09 07:06:12
问题 I am using NSPersistentCloudKitContainer . All data sync in iCloud. And when uninstalled the app, its sync correctly. However, it's required to encrypt sensitive data. I made my password attribute Transformable. Thus work fine locally. However when I delete the app. Install again. All other attributes(String, Int) sync correctly but transformable attribute does not export/synced. Here is my Model public class EmployeeEntity: NSManagedObject { @NSManaged public var password: NSObject?

NSFetchedResultsController returns duplicates (the same objectID and reference)

强颜欢笑 提交于 2020-05-08 11:35:44
问题 I'm experiencing a weird behaviour with NSFetchedResultsController. It is new in iOS 10. Straight to the point: fetchedObjects contains duplicate objects. This is not by any mean "duplicate" in my own criteria. They literally have the same objectIDs and the same reference. How does it happen in my app: FRC is setup and fetch performed 2 objects are fetched (in this example) Something happens in my sync layer, another object (that fetch items are in relationship with) is updated FRC calls

NSFetchedResultsController returns duplicates (the same objectID and reference)

*爱你&永不变心* 提交于 2020-05-08 11:34:46
问题 I'm experiencing a weird behaviour with NSFetchedResultsController. It is new in iOS 10. Straight to the point: fetchedObjects contains duplicate objects. This is not by any mean "duplicate" in my own criteria. They literally have the same objectIDs and the same reference. How does it happen in my app: FRC is setup and fetch performed 2 objects are fetched (in this example) Something happens in my sync layer, another object (that fetch items are in relationship with) is updated FRC calls

How to represent Core Data optional Scalars (Bool/Int/Double/Float) in Swift?

会有一股神秘感。 提交于 2020-05-07 11:46:42
问题 (first noticed on: Xcode 8.2.1, iOS 10, Swift 3) (still present as of: Xcode 9 beta 3, iOS11, Swift 4) We all know that the Core Data concept of optionals precedes and is not strictly tied to the Swift concept of optionals . And we have accepted that even if a Core Data attribute is marked as Non-optional , the auto-generated NSManagedObject subclass has an optional type: (some people manually remove the ? with no adverse effects, some don't, but that's beside the point) (From here on the