cdq icon indicating copy to clipboard operation
cdq copied to clipboard

Failed to load optimized model at path

Open fieldly opened this issue 10 years ago • 4 comments

Hello,

I have a problem with migrations. When I add new migrations my users have to uninstall and reinstall the app in order to get it working (crashing otherwise).

I get this error:

<Warning>: CoreData: Failed to load optimized model at path '/var/mobile/Containers/Bundle/Application/2F958BC5-E32A-44E3-8B4A-B7A0768CA195/Apper.app/Apper.momd/0001 initial.omo'

Also got the error:

Terminating app due to uncaught exception 'RuntimeError', reason: 'app_delegate.rb:132:in `create_local_store': Can't find or automatically infer mapping model for migration (RuntimeError)

What is this error?

fieldly avatar Oct 26 '15 09:10 fieldly

Hey @fieldly Can you post samples of your db schema files?

One thing to note is that when you create a new schema, it's not a diff, it's a replication with additions or deletions.

  1. Copy the ENTIRE file
  2. Rename the file so that it's sequential (001_schema.rb, 002_schema_added_something.rb, etc.)
  3. Change the schema definition at the top of the NEW file to match the file name.
  4. Make additions or deletions to your schema in the new file.
  5. Save schema and compile.

As long as you're adding and deleting things, CoreData's lightweight migrations should handle everything for you automatically. Do NOT change the type of existing schema items or you'll have the same problems as you're having now with users having to delete the app and reinstall.

Hope this helps!

markrickert avatar Oct 26 '15 17:10 markrickert

Having similar issue after updating xcode and RM to 4.5.

<Warning>: CoreData: Failed to load optimized model at path '/var/mobile/Containers/Bundle/Application/D20D5112-0CD1-4D04-A332-A5692F9A74DB/Winterhawks Pick6.app/winterhawks_pick6_ios.momd/0007 modify user points type again.om

MOPineyro avatar Nov 03 '15 21:11 MOPineyro

I'm seeing a pattern here of spaces in file names instead of underscores. I'm wondering if that's the issue here...

markrickert avatar Nov 03 '15 21:11 markrickert

Receiving the same error despite adding underscores

CoreData: Failed to load optimized model at path '/Users/mopineyro/Library/Developer/CoreSimulator/Devices/7AF779B3-E56D-4EBA-8EE4-B2A9AF1D9663/data/Containers/Bundle/Application/EA921B45-7132-41AD-BF5B-3F1C8DACE603/Winterhawks Pick6.app/winterhawks_pick6_ios.momd/0007_modify_user_points_type_again.omo'

MOPineyro avatar Nov 04 '15 19:11 MOPineyro