Coredata: Annotation: Postsavemaintenance: Incremental_Vacuum with Freelist_Count - 4 and Pages_To_Free 0

CoreData: annotation: Failed to load optimized model at path (Xcode 11 - iOS 12)

I was able to solve the issue thanks to the hint in @ChaitanyaKhurana's comment above.

Here is the swift code I have implemented, replacing the original single line

let container = NSPersistentContainer(name: "ModelName")

Part of the code is needed to retrieve the model version string (from the .plist file located in the .momd package) in order to avoid having to update the code each time there is a new model version.

Please also note that the new/alternative code only executes on iOS versions prior to 13.0 as there is not issue on iOS 13.

let modelName = "ModelName"

var container: NSPersistentContainer!

if #available(iOS 13.0, *) {
container = NSPersistentContainer(name: modelName)
} else {
var modelURL = Bundle(for: type(of: self)).url(forResource: modelName, withExtension: "momd")!
let versionInfoURL = modelURL.appendingPathComponent("VersionInfo.plist")
if let versionInfoNSDictionary = NSDictionary(contentsOf: versionInfoURL),
let version = versionInfoNSDictionary.object(forKey: "NSManagedObjectModel_CurrentVersionName") as? String {
modelURL.appendPathComponent("\(version).mom")
let managedObjectModel = NSManagedObjectModel(contentsOf: modelURL)
container = NSPersistentContainer(name: modelName, managedObjectModel: managedObjectModel!)
} else {
//fall back solution; runs fine despite "Failed to load optimized model" warning
container = NSPersistentContainer(name: modelName)
}
}

CoreData: annotation: PostSaveMaintenance: incremental_vacuum with freelist_count - 52 and pages_to_free 10

This message is due to Core Data undergoing a VACUUM operation in order to free up space in the Sqlite database. More information here. It is normal to see this message.

CoreData: annotation: Failed to load optimized model at path '/var/containers/Bundle/ .... '

So, after a few days I have managed to solve it. I'm not familiar enough with the insides of Xcode, but all I had to do was rewrite the CoreData Model. Best to make a back up before trying this!

  1. Take a screenshot of current attributes and delete the CoreDataModel ( .xcdatamodeld file)
  2. Add a new file to project (Data Model template)
  3. Write old attributes
  4. Recompile and build

My assumption would be that the problem was caused after migrating a project started in Xcode 8 (written in Swift 3) to Xcode 9 (upgraded to Swift 4). It had no problem with devices running iOS 11 (same upgrade level as Xcode 9), but found it to consistently cause lag and eventually crashes in older iOS versions.

I don't understand why simply modifying file properties did not fix it, but I'm happy to have fixed it and move on.

CoreData: annotation: Failed to load optimized model at path 'Users/~/GoogleMaps.bundle/GMSCacheStorage.momd/StorageWithTileProto.omo'

I just spent 5 hours with the same problem. Sometimes the map would show up and sometimes it would not. In the end, I found out I had a problem with my key. I accidentally deleted its permission to iOS. Some emulators were showing the map because they had the key cached. And some others were displaying the "StorageWithTileProto" error, because they had the tiles cached with the old key but no authorization do show it.
I would recommend anyone with the "StorageWithTileProto" to test it with a new unrestricted key and to fully delete the app from the device/emulator before testing it. This might solve your problem as well.

CoreData: annotation: Failed to load optimized model (React Native)

I simply had to start XCode one time after the update and then I was asked if I want to install additional components. That's all.



Related Topics



Leave a reply



Submit