magicalpanda / MagicalRecord

Super Awesome Easy Fetching for Core Data!
Other
10.8k stars 1.79k forks source link

[AutoMigration]Not working in iOS 8.0 #1207

Open fghfjujiber opened 8 years ago

fghfjujiber commented 8 years ago

I set up the core data stack in AppDelegate, and I do all the add model version stuff, but it still fails in iOS 8.0. The error shows that the persistent store cannot be found. All the change I did to my Model is just adding a new entity. I am planning to user manual migration. BTW, I create the project with core data ticked, is that related to my issue?

fghfjujiber commented 8 years ago

CoreData: error: -addPersistentStoreWithType:SQLite configuration:(null) URL:file:///var/mobile/Containers/Data/Application/176C65E6-11A3-4C7B-9CD8-AA92F368BD3F/Library/Application%20Support/TeamUp/TeamUp.sqlite options:{ NSInferMappingModelAutomaticallyOption = 1; NSMigratePersistentStoresAutomaticallyOption = 1; NSSQLitePragmasOption = { "journal_mode" = WAL; }; } ... returned error Error Domain=NSCocoaErrorDomain Code=134130 "The operation couldn’t be completed. (Cocoa error 134130.)" UserInfo=0x16c54660 {URL=file:///var/mobile/Containers/Data/Application/176C65E6-11A3-4C7B-9CD8-AA92F368BD3F/Library/Application%20Support/TeamUp/TeamUp.sqlite, metadata={ NSPersistenceFrameworkVersion = 519; NSStoreModelVersionHashes = { Chat = <9f83a4fa 789d9aef b399c464 fca2e9b8 58643774 37ba0b74 90247115 7e817903>; Room = <e612c867 f1029b13 bb6995c5 b3122a05 c0d76010 a58ad8cd 8c64c8f4 a7a7cd7f>; Roster = <e5f6b124 dab26e0c 68bf094d 1e135e59 9acb9ef1 68680087 a9de97ed 5f7188bf>; Test = <3a8ef284 d332f977 d2bcbb4a 7628bfeb 6e7a5482 acba679c 18cc405c 8bbdb335>; XMPPCapsCoreDataStorageObject = <fcc8a450 20ad494a 3d9079f2 42eddbf4 6fdda8f1 5ffd78b6 70adb56d e120d7ae>; XMPPCapsResourceCoreDataStorageObject = <b4ad78f7 b849a2a8 4193de79 0b80bc86 94e575f4 7e821033 a785a017 c079e928>; XMPPGroupCoreDataStorageObject = <2d9d5e0b d7f6f74d 918cb9af f0fe44a4 fae60105 8144ccd0 112d0729 cead71eb>; "XMPPMessageArchiving_Contact_CoreDataObject" = <b35921c6 4d8667a9 39c46e41 b04053e9 2b2b2836 db2d9621 b37085a4 4437819f>; "XMPPMessageArchiving_Message_CoreDataObject" = <55ad74f0 602bd856 0a324688 c8f8d0e3 af1ba3ff adf512a3 de40f457 037acf23>; XMPPResourceCoreDataStorageObject = <e31f4b20 a3c302b6 7b2a74e1 2737e8cb d440ae9a 5bfb503b 32330cdd 17a98978>; XMPPRoomMessageCoreDataStorageObject = <e93f6bf3 51ecd04c 083c2478 35c336cb 245370ad 495268d5 e8324e34 af225773>; XMPPRoomMessageHybridCoreDataStorageObject = <13824bff 7a0977e0 5f6d47e3 29364758 76864702 329c31e7 02e1d2dc 01ad37de>; XMPPRoomOccupantCoreDataStorageObject = <2848335c 9cf626d6 44c5fe10 2c01a746 329d3e3b b785cd89 81949a40 28376f5c>; XMPPUserCoreDataStorageObject = <0ef429b0 41998c3a 496ab11a 26bde9ac 7d1a929f 9d7ea102 9ece131d b5a6890c>; XMPPvCardAvatarCoreDataStorageObject = <66d4bf5e 05ea2ec1 f355fcd4 32dcdd55 9288a6f0 68d8c045 6c13b9c6 ac300d7a>; XMPPvCardCoreDataStorageObject = <adac5b15 e1713a10 bcd16518 eff333ee 4543e45c 13ae60ac ce8bc593 f9b4d1ad>; XMPPvCardTempCoreDataStorageObject = <8a708229 823759d9 1ff41f51 3d9913d1 6ae42b49 b0c94c6b 40b41093 51840e6b>; }; NSStoreModelVersionHashesVersion = 3; NSStoreModelVersionIdentifiers = ( "" ); NSStoreType = SQLite; NSStoreUUID = "F24E3BEB-91EB-4B7C-8193-2351FBBB53E2"; "_NSAutoVacuumLevel" = 2; }, reason=Can't find model for source store} with userInfo dictionary { URL = "file:///var/mobile/Containers/Data/Application/176C65E6-11A3-4C7B-9CD8-AA92F368BD3F/Library/Application%20Support/TeamUp/TeamUp.sqlite"; metadata = { NSPersistenceFrameworkVersion = 519; NSStoreModelVersionHashes = { Chat = <9f83a4fa 789d9aef b399c464 fca2e9b8 58643774 37ba0b74 90247115 7e817903>; Room = <e612c867 f1029b13 bb6995c5 b3122a05 c0d76010 a58ad8cd 8c64c8f4 a7a7cd7f>; Roster = <e5f6b124 dab26e0c 68bf094d 1e135e59 9acb9ef1 68680087 a9de97ed 5f7188bf>; Test = <3a8ef284 d332f977 d2bcbb4a 7628bfeb 6e7a5482 acba679c 18cc405c 8bbdb335>; XMPPCapsCoreDataStorageObject = <fcc8a450 20ad494a 3d9079f2 42eddbf4 6fdda8f1 5ffd78b6 70adb56d e120d7ae>; XMPPCapsResourceCoreDataStorageObject = <b4ad78f7 b849a2a8 4193de79 0b80bc86 94e575f4 7e821033 a785a017 c079e928>; XMPPGroupCoreDataStorageObject = <2d9d5e0b d7f6f74d 918cb9af f0fe44a4 fae60105 8144ccd0 112d0729 cead71eb>; "XMPPMessageArchiving_Contact_CoreDataObject" = <b35921c6 4d8667a9 39c46e41 b04053e9 2b2b2836 db2d9621 b37085a4 4437819f>; "XMPPMessageArchiving_Message_CoreDataObject" = <55ad74f0 602bd856 0a324688 c8f8d0e3 af1ba3ff adf512a3 de40f457 037acf23>; XMPPResourceCoreDataStorageObject = <e31f4b20 a3c302b6 7b2a74e1 2737e8cb d440ae9a 5bfb503b 32330cdd 17a98978>; XMPPRoomMessageCoreDataStorageObject = <e93f6bf3 51ecd04c 083c2478 35c336cb 245370ad 495268d5 e8324e34 af225773>; XMPPRoomMessageHybridCoreDataStorageObject = <13824bff 7a0977e0 5f6d47e3 29364758 76864702 329c31e7 02e1d2dc 01ad37de>; XMPPRoomOccupantCoreDataStorageObject = <2848335c 9cf626d6 44c5fe10 2c01a746 329d3e3b b785cd89 81949a40 28376f5c>; XMPPUserCoreDataStorageObject = <0ef429b0 41998c3a 496ab11a 26bde9ac 7d1a929f 9d7ea102 9ece131d b5a6890c>; XMPPvCardAvatarCoreDataStorageObject = <66d4bf5e 05ea2ec1 f355fcd4 32dcdd55 9288a6f0 68d8c045 6c13b9c6 ac300d7a>; XMPPvCardCoreDataStorageObject = <adac5b15 e1713a10 bcd16518 eff333ee 4543e45c 13ae60ac ce8bc593 f9b4d1ad>; XMPPvCardTempCoreDataStorageObject = <8a708229 823759d9 1ff41f51 3d9913d1 6ae42b49 b0c94c6b 40b41093 51840e6b>; }; NSStoreModelVersionHashesVersion = 3; NSStoreModelVersionIdentifiers = ( "" ); NSStoreType = SQLite; NSStoreUUID = "F24E3BEB-91EB-4B7C-8193-2351FBBB53E2"; "_NSAutoVacuumLevel" = 2; }; reason = "Can't find model for source store"; } 2016-03-17 11:49:00.370 TeamUp[17262:2800486] CoreData: annotation: NSPersistentStoreCoordinator's current model hashes are { Chat = <9f83a4fa 789d9aef b399c464 fca2e9b8 58643774 37ba0b74 90247115 7e817903>; Room = <e612c867 f1029b13 bb6995c5 b3122a05 c0d76010 a58ad8cd 8c64c8f4 a7a7cd7f>; Roster = <e5f6b124 dab26e0c 68bf094d 1e135e59 9acb9ef1 68680087 a9de97ed 5f7188bf>; XMPPCapsCoreDataStorageObject = <fcc8a450 20ad494a 3d9079f2 42eddbf4 6fdda8f1 5ffd78b6 70adb56d e120d7ae>; XMPPCapsResourceCoreDataStorageObject = <b4ad78f7 b849a2a8 4193de79 0b80bc86 94e575f4 7e821033 a785a017 c079e928>; XMPPGroupCoreDataStorageObject = <2d9d5e0b d7f6f74d 918cb9af f0fe44a4 fae60105 8144ccd0 112d0729 cead71eb>; "XMPPMessageArchiving_Contact_CoreDataObject" = <b35921c6 4d8667a9 39c46e41 b04053e9 2b2b2836 db2d9621 b37085a4 4437819f>; "XMPPMessageArchiving_Message_CoreDataObject" = <55ad74f0 602bd856 0a324688 c8f8d0e3 af1ba3ff adf512a3 de40f457 037acf23>; XMPPResourceCoreDataStorageObject = <e31f4b20 a3c302b6 7b2a74e1 2737e8cb d440ae9a 5bfb503b 32330cdd 17a98978>; XMPPRoomMessageCoreDataStorageObject = <e93f6bf3 51ecd04c 083c2478 35c336cb 245370ad 495268d5 e8324e34 af225773>; XMPPRoomMessageHybridCoreDataStorageObject = <13824bff 7a0977e0 5f6d47e3 29364758 76864702 329c31e7 02e1d2dc 01ad37de>; XMPPRoomOccupantCoreDataStorageObject = <2848335c 9cf626d6 44c5fe10 2c01a746 329d3e3b b785cd89 81949a40 28376f5c>; XMPPUserCoreDataStorageObject = <0ef429b0 41998c3a 496ab11a 26bde9ac 7d1a929f 9d7ea102 9ece131d b5a6890c>; XMPPvCardAvatarCoreDataStorageObject = <66d4bf5e 05ea2ec1 f355fcd4 32dcdd55 9288a6f0 68d8c045 6c13b9c6 ac300d7a>; XMPPvCardCoreDataStorageObject = <adac5b15 e1713a10 bcd16518 eff333ee 4543e45c 13ae60ac ce8bc593 f9b4d1ad>; XMPPvCardTempCoreDataStorageObject = <8a708229 823759d9 1ff41f51 3d9913d1 6ae42b49 b0c94c6b 40b41093 51840e6b>; } 2016-03-17 11:49:00.377 TeamUp[17262:2800486] Removed incompatible model version: TeamUp.sqlite

fghfjujiber commented 8 years ago

Pls Help!

magicalpandatest commented 8 years ago

Most likely, you forgot to add a version to your model. If you just change the model in place, your model then become incompatible with your store file. Revert your model back to what it was prior to your change, and add a new version with your change there. That should get you going again.

On Mar 17, 2016, at 10:45 AM, Jack Chen notifications@github.com wrote:

I set up the core data stack in AppDelegate, and I do all the add model version stuff, but it still fails in iOS 8.0. The error shows that the persistent store cannot be found. All the change I did to my Model is just adding a new entity. I am planning to user manual migration. BTW, I create the project with core data ticked, is that related to my issue?

— You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub https://github.com/magicalpanda/MagicalRecord/issues/1207

fghfjujiber commented 8 years ago

@magicalpandatest Yea, I did add a new model version before changing the model, iOS 9 works, but iOS 8 got the errors above. How can this happen?

sgup77 commented 8 years ago

@fghfjujiber :: Did you find any solution. I might be facing the same issue.

wongzigii commented 8 years ago

Met this issue too.