开发者

Core Data crash in initWithManagedObjectModel

开发者 https://www.devze.com 2023-01-25 16:34 出处:网络
I\'ve got the following crash log from two testers, different devices (3GS and 4) and versions (4.1 and 4.2 GM):

I've got the following crash log from two testers, different devices (3GS and 4) and versions (4.1 and 4.2 GM):

Exception Type:  EXC_CRASH (SIGABRT)
Exception Codes: 0x00000000, 0x00000000
Crashed Thread:  0

Thread 0 Crashed:
0   libSystem.B.dylib               0x000792d4 __kill + 8
1   libSystem.B.dylib               0x000792c4 kill + 4
2   libSystem.B.dylib               0x000792b6 raise + 10
3   libSystem.B.dylib               0x0008dd72 abort + 50
4   libstdc++.6.dylib               0x00044a20 __gnu_cxx::__verbose_terminate_handler() + 376
5   libobjc.A.dylib            开发者_开发知识库     0x00006594 _objc_terminate + 104
6   libstdc++.6.dylib               0x00042df2 __cxxabiv1::__terminate(void (*)()) + 46
7   libstdc++.6.dylib               0x00042e46 std::terminate() + 10
8   libstdc++.6.dylib               0x00042f16 __cxa_throw + 78
9   libobjc.A.dylib                 0x000054c4 objc_exception_throw + 64
10  CoreData                        0x000030a6 -[NSPersistentStoreCoordinator initWithManagedObjectModel:] + 254
11  MyApp                           0x00002d50 -[FooAppDelegate persistentStoreCoordinator] (FooAppDelegate.m:249)
12  MyApp                           0x00002bb4 -[FooAppDelegate managedObjectContext] (FooAppDelegate.m:207)
13  MyApp                           0x000021b8 -[FooAppDelegate awakeFromNib] (FooAppDelegate.m:25)
[snip]

This is code from the standard Core Data app template, so I changed not much in that area. What I did change was moving from lightweight migrations to passing nil as the options, and deleting previous data model.xcdatamodel, model2.xcdatamodel, ..., model7.xcdatamodel files except for the latest, which I renamed from model7.xcdatamodel to model.xcdatamodel.

The crash does not happen on my test phones, an iPhone 4 and an iPhone 3G, both running 4.2. I asked my testers to delete the app off their iPhones and re-installing it, but the issue is the same. All works well in the simulator, for iOS4 to 4.2. Any idea what's going on here?

Thanks!


I think the problem was, fundamentally, that I removed all the data models that were unused, but my switching to the current data model didn't stick for some reason.

When I branched out to try and fix the broken version, the git diff for one of the changes was setting the current model version from model7.xcdatamodel to model.xcdatamodel. I am fairly sure I did that previously, since the little green checkmark showed just fine in XCode on the only data model left, but for some reason it didn't stick.

There were two revisions between my last testing version (0.19) and the submitted version (1.0.0). I double checked the changes in those two revisions, and one of them sets the current data model to the correct one. That's why my tests with the submitted version worked (the data model was set correctly), but the tester's version didn't (because it wasn't set correctly).

Glad I finally figured it out. The morale: Make double extra sure your data model changes are all there.

0

精彩评论

暂无评论...
验证码 换一张
取 消