-[NSCFDictionary initWithObjects:forKeys:count:]:尝试在对象[0]处插入零值(键:sourceRelationship)

发布于 2024-12-12 07:02:26 字数 3676 浏览 0 评论 0原文

我和这个人度过了一个非常糟糕的夜晚。自从我必须快速更新以来,我一直在 iOS 5.0 上运行和测试我的代码。我遇到了安装问题,所以直到最近我才可以使用 4.3 Simulator。我(以为我已经)解决了所有轻量级核心数据迁移问题。今晚,我在 4.3 模拟器和运行 4.3 的 iPad 上运行该应用程序。我发现的结果很糟糕。

每次都会出现这个错误:

2011-10-27 07:01:44.045 AppName[924:10d03] * 由于以下原因终止应用程序 未捕获的异常“NSInvalidArgumentException”,原因:“*” -[NSCFDictionary initWithObjects:forKeys:count:]:尝试在对象[0]处插入零值(键:sourceRelationship)' * 第一次抛出时的调用堆栈:( 0 CoreFoundation 0x018655a9 exceptionPreprocess + 185 1 libobjc.A.dylib
0x01a66313 objc_exception_throw + 44 2 CoreFoundation
0x017aedcb -[__NSPlaceholderDictionary initWithObjects:forKeys:count:] + 587 3 CoreFoundation 0x017c76da +[NSDictionary DictionaryWithObject:forKey:] + 74 4 CoreData 0x0135bdea -[_NSSQLTableMigrationDescription appendStatementsToPrepareForMigration:migrationContext:] + 1178 5
核心数据 0x01357254 -[_NSSQLiteStoreMigrator createEntityMigrationStatements] + 356 6 CoreData 0x01356246 -[_NSSQLiteStoreMigrator PerformMigration:] + 86 7 CoreData 0x0135c78f -[NSSQLiteInPlaceMigrationManager migrateStoreFromURL:type:options:withMappingModel:toDestinationURL:destinationType:destinationOptions:error:] + 1039 8 CoreData 0x013414ca -[NSStoreMigrationPolicy(InternalMethods) migrateStoreAtURL:toURL:storeType:options:withManager:error:] + 154 9 核心数据 0x01342052 -[NSStoreMigrationPolicy migrateStoreAtURL:withManager:元数据:选项:错误:] + 146 10 核心数据 0x01342f83 -[NSStoreMigrationPolicy(InternalMethods) _gatherDataAndPerformMigration:] + 1315 11 CoreData 0x01256aec -[NSPersistentStoreCoordinator addPersistentStoreWithType:配置:URL:选项:错误:] + 2412 12 应用程序名称 0x0007aae7 -[AppDelegate persistenceStoreCoordinator] + 791 13 AppName 0x0007a621 -[AppDelegate ManagedObjectContext] + 97 14 AppName 0x0007c3cd -[AppDelegate getSettings] + 125 15 AppName
0x00078160 - [BagAppDelegate刷新设置] + 48 16 应用程序名称 0x00077cd7 -[AppDelegate应用程序:didFinishLaunchingWithOptions:] + 391 17 UIKit 0x00409c89 -[UIApplication _callInitializationDelegatesForURL:有效负载:挂起:] + 1163 18 UIKit 0x0040bd88 -[UIApplication _runWithURL:有效负载:launchOrientation:statusBarStyle:statusBarHidden:] + 439 19 UIKit 0x00416617 -[UIApplication handleEvent:withNewEvent:] + 1533 20 UIKit 0x0040eabf -[UIApplication sendEvent:] + 71 21 UIKit
0x00413f2e _UIApplicationHandleEvent + 7576 22 图形服务
0x01f03992 PurpleEventCallback + 1550 23 CoreFoundation
0x01846944 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION
+ 52 24 CoreFoundation 0x017a6cf7 __CFRunLoopDoSource1 + 215 25 CoreFoundation 0x017a3f83 __CFRunLoopRun + 979 26 CoreFoundation
0x017a3840 CFRunLoopRunSpecific + 208 27 核心基础
0x017a3761 CFRunLoopRunInMode + 97 28 UIKit
0x0040b7d2 -[UIApplication _run] + 623 29 UIKit
0x00417c93 UIApplicationMain + 1160 30 应用程序名称
0x0000232d main + 125 31 应用程序名称
0x000022a5开始+53

,当我设置 persistenceStoreCoordinator 时,它显示错误在这里:

NSError *error;
if (![persistentStoreCoordinator addPersistentStoreWithType:NSSQLiteStoreType configuration:nil URL:storeUrl options:options error:&error]) {
    // Update to handle the error appropriately.
    NSLog(@"App Delegate - persistentStoreCoordinator Save Error %@, %@", error, [error userInfo]);
    exit(-1);  // Fail
}  
return persistentStoreCoordinator;

我很确定后面的代码没问题 - 我从来没有遇到过任何问题。

该错误显然与轻量级迁移有关,但我无法弄清楚是什么。我已经坐在这里哭泣了几个小时(但我是一个女孩,所以没关系.. jk),似乎没有任何作用,而且我还没有从谷歌搜索中得到任何好的信息。

我不会更新现有的应用程序,只是在发生这种情况时尝试安装新的应用程序。

我真的非常需要帮助,通常我知道该怎么做,但现在我迷失在太空中。预先感谢您的任何见解。

编辑:认为这可能与修复磁盘权限有关。没用。映射模型似乎有问题。我想这将是自动创建的,因为我没有创建任何。

I am having a pretty bad night with this one. I have been running and testing my code on iOS 5.0 since I had to quickly update.. I had installation problems so 4.3 Simulator wasn't available to me until just recently. I (thought I had) worked out all of my lightweight Core Data migration issues. Tonight, I went to run the app in the 4.3 Simulator and on an iPad running 4.3. What I found was awful.

This error every time:

2011-10-27 07:01:44.045 AppName[924:10d03] * Terminating app due to
uncaught exception 'NSInvalidArgumentException', reason: '*

-[NSCFDictionary initWithObjects:forKeys:count:]: attempt to insert nil value at objects[0] (key: sourceRelationship)'
* Call stack at first throw: ( 0 CoreFoundation 0x018655a9 exceptionPreprocess + 185 1 libobjc.A.dylib
0x01a66313 objc_exception_throw + 44 2 CoreFoundation
0x017aedcb -[__NSPlaceholderDictionary initWithObjects:forKeys:count:]
+ 587 3 CoreFoundation 0x017c76da +[NSDictionary dictionaryWithObject:forKey:] + 74 4 CoreData 0x0135bdea -[_NSSQLTableMigrationDescription
appendStatementsToPrepareForMigration:migrationContext:] + 1178 5
CoreData 0x01357254
-[_NSSQLiteStoreMigrator createEntityMigrationStatements] + 356 6 CoreData 0x01356246
-[_NSSQLiteStoreMigrator performMigration:] + 86 7 CoreData 0x0135c78f -[NSSQLiteInPlaceMigrationManager
migrateStoreFromURL:type:options:withMappingModel:toDestinationURL:destinationType:destinationOptions:error:]
+ 1039 8 CoreData 0x013414ca -[NSStoreMigrationPolicy(InternalMethods) migrateStoreAtURL:toURL:storeType:options:withManager:error:] + 154 9
CoreData 0x01342052
-[NSStoreMigrationPolicy migrateStoreAtURL:withManager:metadata:options:error:] + 146 10
CoreData 0x01342f83
-[NSStoreMigrationPolicy(InternalMethods) _gatherDataAndPerformMigration:] + 1315 11 CoreData 0x01256aec -[NSPersistentStoreCoordinator
addPersistentStoreWithType:configuration:URL:options:error:] + 2412
12 AppName 0x0007aae7
-[AppDelegate persistentStoreCoordinator] + 791 13 AppName 0x0007a621
-[AppDelegate managedObjectContext] + 97 14 AppName 0x0007c3cd -[AppDelegate getSettings] + 125 15 AppName
0x00078160 -[BagAppDelegate refreshSettings] + 48 16
AppName 0x00077cd7
-[AppDelegate application:didFinishLaunchingWithOptions:] + 391 17 UIKit 0x00409c89
-[UIApplication _callInitializationDelegatesForURL:payload:suspended:] + 1163 18 UIKit 0x0040bd88 -[UIApplication _runWithURL:payload:launchOrientation:statusBarStyle:statusBarHidden:] + 439 19 UIKit 0x00416617 -[UIApplication handleEvent:withNewEvent:] + 1533 20 UIKit 0x0040eabf -[UIApplication sendEvent:] + 71 21 UIKit
0x00413f2e _UIApplicationHandleEvent + 7576 22 GraphicsServices
0x01f03992 PurpleEventCallback + 1550 23 CoreFoundation
0x01846944 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION

+ 52 24 CoreFoundation 0x017a6cf7 __CFRunLoopDoSource1 + 215 25 CoreFoundation 0x017a3f83 __CFRunLoopRun + 979 26 CoreFoundation
0x017a3840 CFRunLoopRunSpecific + 208 27 CoreFoundation
0x017a3761 CFRunLoopRunInMode + 97 28 UIKit
0x0040b7d2 -[UIApplication _run] + 623 29 UIKit
0x00417c93 UIApplicationMain + 1160 30 AppName
0x0000232d main + 125 31 AppName
0x000022a5 start + 53

and it shows the error as being here, when I set the persistentStoreCoordinator:

NSError *error;
if (![persistentStoreCoordinator addPersistentStoreWithType:NSSQLiteStoreType configuration:nil URL:storeUrl options:options error:&error]) {
    // Update to handle the error appropriately.
    NSLog(@"App Delegate - persistentStoreCoordinator Save Error %@, %@", error, [error userInfo]);
    exit(-1);  // Fail
}  
return persistentStoreCoordinator;

I'm pretty sure that latter code is okay - I have never had any problem with it.

The error clearly has something to do with lightweight migration and for the life of me I can't figure out what. I have been sitting here in tears for hours (but I'm a girl so that's okay .. jk) and nothing seems to work, and I haven't gotten any good info from google searches.

I am not updating an existing app just trying to install a new one when this happens.

I really need help desperately, usually I have some idea of what to do but I am so lost in space right now. Thanks in advance for any insights.

EDIT: Thought it might have something to do with repairing disk permissions. Didn't work. Seems like there is something wrong with a mapping model. I guess it would be the automatically created one(s) because I didn't create any.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

淤浪 2024-12-19 07:02:26

这并不是一个真正的答案,但您可以考虑一些事情来尝试追查问题:

  • storeURLoptions 的值在当时是否正确调用?

  • 当您遇到崩溃时,是否应该真正进行迁移? (即数据库是否处于当前模型之前的状态)?当您从空数据库开始时,您是否会遇到崩溃?

  • 你们有多少型号?您能否删除一些以尝试找出导致问题的原因?

Not really an answer, but a few things you could think about to try and track down the problem:

  • Are the values of storeURL and options correct at the time of the invocation?

  • When you get the crash, should a migration actually happen? (i.e., is the database in a pre-current-model state)? Do you get the crash when you start with empty database?

  • How many models do you have? Could you delete some to try and track down which one is causing the problem?

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文