Core Data & Xcode 11: Please switch to using “NSSecureUnarchiveFromData” or a subclass of NSSecureUnarchiveFromDataTransformer

Swift 5.4.2 This worked for me. EDIT Link to the article is here. Click on the .xcdatamodeld file in the project navigator Click on the Entity that has a Transformable Attribute Click on the Transformable Attribute Click the ‘Show Data Model Inspector’ icon Enter ‘NSSecureUnarchiveFromDataTransformer’ in the Transformer field – EDIT Make this ‘NSSecureUnarchiveFromData’ as … Read more

How to store CLLocation using Core Data (iPhone)?

What you’re doing is fine. You should save the latitude and longitude as doubles in Core Data. When you need to get the information again, get the doubles back from Core Data and construct a CLLocationCoordinate2D struct with a function like CLLocationCoordinate2DMake. There’s no built in way to store a location, so storing the latitude … Read more

(NSFetchedResultsController): couldn’t read cache file to update store info timestamps

This error should not be ignored because it can cause app crash. It is related to an iOS 10 bug of file descriptor leaks. There are reports on openradar and Apple Bug Reporter. What happen: if you load a view controller using NSFetchedResultsController with a non-nil cacheName, every time you save the managed object context … Read more

How to sync records between Core Data and CloudKit efficiently

As of iOS 13, there are new API’s that simplify this synchronization for developers. I would recommend you to watch the WWDC19 session about the new synchronization between CoreData and CloudKit. Please note that these new API’s only work for iOS 13+. Video: https://developer.apple.com/videos/play/wwdc2019/202/ In short, you need to start using NSPersistentCloudKitContainer instead of NSPersistentContainer. … Read more

xcode 7 generates core data entity with additional CoreDataProperties category

I just noticed this and also could not find any documentation about it but I’ve experimented with this new feature and it works like this. When you first generate NSManagedObject subclass from your Core Data model then Xcode will generate 4 files: DBUser.h #import <Foundation/Foundation.h> #import <CoreData/CoreData.h> NS_ASSUME_NONNULL_BEGIN @interface DBUser : NSManagedObject // Insert code … Read more

CoreData and SwiftUI: Context in environment is not connected to a persistent store coordinator

Environment values like your moc are automatically passed only to other views in the hierarchy. So if you show a sheet or anything that is not part of your view hierarchy you’ll lose the environment and you will need to pass the moc to the new hierarchy, like you did for ContentView. Check this code … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)