gpt4 book ai didi

core-data - -[NSCFDictionary initWithObjects :forKeys:count:]: attempt to insert nil value at objects[0] (key: sourceRelationship)

转载 作者:行者123 更新时间:2023-12-03 15:27:22 29 4
gpt4 key购买 nike

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

每次都出现这个错误:

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



当我设置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;

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

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

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

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

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

最佳答案

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

  • storeURL 的值吗?和 options在调用时正确吗?
  • 当您遇到崩溃时,是否真的应该进行迁移? (即,数据库是否处于当前模型之前的状态)?当你从空数据库开始时,你会崩溃吗?
  • 你有几个型号?您能否删除一些以尝试找出导致问题的原因?
  • 关于core-data - -[NSCFDictionary initWithObjects :forKeys:count:]: attempt to insert nil value at objects[0] (key: sourceRelationship),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7912333/

    29 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com