0

I am seeing a problem that seems to be unique to iOS 5, where trying to encode a dictionary results in a crash because an array is populated with a nil object in the process.

This is confusing to me because I would think in order for the following to happen, the dictionary would need to contain nil, which I would expect would crash at the time the dictionary is populated as opposed to when it is encoded.

Any idea what could be causing this?

Application Specific Information:
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[__NSPlaceholderArray initWithObjects:count:]: attempt to insert nil object from objects[0]'

Last Exception Backtrace:
0   CoreFoundation                      0x3277088f ___exceptionPreprocess + 163
1   libobjc.A.dylib                     0x347c6259 _objc_exception_throw + 33
2   CoreFoundation                      0x326c29e9 -[__NSPlaceholderArray initWithObjects:count:] + 129
3   Foundation                          0x38071be7 -[NSDictionary(NSDictionary) encodeWithCoder:] + 819
4   Foundation                          0x38047aa1 __encodeObject + 961
5   Tumblr                              0x00105bab -[MyModelObject encodeWithCoder:] (MyModelObject.m:474)
6   Foundation                          0x38047aa1 __encodeObject + 961
7   Foundation                          0x380473c9 +[NSKeyedArchiver archivedDataWithRootObject:] + 161
8   CoreData                            0x31e6cca7 -[NSSQLiteConnection execute] + 2219
9   CoreData                            0x31f3455f -[NSSQLiteConnection updateRow:] + 551
10  CoreData                            0x31f1120d -[NSSQLConnection performAdapterOperation:] + 85
11  CoreData                            0x31f11183 -[NSSQLConnection performAdapterOperations:] + 115
12  CoreData                            0x31f1c38b -[NSSQLCore _performChangesWithAdapterOps:] + 207
13  CoreData                            0x31f1bfcb -[NSSQLCore performChanges] + 623
14  CoreData                            0x31f1afc5 -[NSSQLCore saveChanges:] + 309
15  CoreData                            0x31e7325f -[NSSQLCore executeRequest:withContext:error:] + 947
16  CoreData                            0x31e72337 -[NSPersistentStoreCoordinator executeRequest:withContext:error:] + 1131
17  CoreData                            0x31eda287 -[NSManagedObjectContext save:] + 523
Bryan Irace
  • 1,855
  • 2
  • 20
  • 38

0 Answers0