Closed mevdev closed 8 years ago
Our UITableView was not getting the change notifications (data fetched with RealmResultsController):
realm.add(object, update: type.primaryKey() != nil)
but once we changed to
realm.addWithNotification(object, update: type.primaryKey() != nil)
it started crashing hard, although it was updating the delegate methods then.
Sorry wrong window.
2016-04-06 16:01:02.347 XXX[27792:268230] * Terminating app due to uncaught exception 'Invalid value origin', reason: 'Object must be from the Realm being queried' * First throw call stack: ( 0 CoreFoundation 0x000000010956ee65 exceptionPreprocess + 165 1 libobjc.A.dylib 0x0000000108fe7deb objc_exception_throw + 48 2 Realm 0x0000000105dce2b1 _ZL15RLMPreconditionbP8NSStringS0_z + 657 3 Realm 0x0000000105df82ca _ZN12_GLOBALN_128add_link_constraint_to_queryERN5realm5QueryE23NSPredicateOperatorTypeRKNS_15ColumnReferenceEP9RLMObject + 1370 4 Realm 0x0000000105df5c79 _ZN12_GLOBALN_126do_add_constraint_to_queryIJNS_15ColumnReferenceEU8strongP11objcobjectEEEvRN5realm5QueryE15RLMPropertyType23NSPredicateOperatorTypemDpT + 1353 5 Realm 0x0000000105de9532 _ZN12_GLOBALN_123add_constraint_to_queryINS_15ColumnReferenceEU8__strongP11objc_objectEEvRN5realm5QueryE15RLMPropertyType23NSPredicateOperatorTypemTT0 + 658 6 Realm 0x0000000105dd2f47 _ZN12_GLOBALN_134update_query_with_value_expressionEP9RLMSchemaP15RLMObjectSchemaRN5realm5QueryEP8NSStringP11objc_objectP21NSComparisonPredicate + 967 7 Realm 0x0000000105dcfcf6 _ZN12_GLOBALN_127update_query_with_predicateEP11NSPredicateP9RLMSchemaP15RLMObjectSchemaRN5realm5QueryE + 5286 8 Realm 0x0000000105dcec22 _ZN12_GLOBALN_127update_query_with_predicateEP11NSPredicateP9RLMSchemaP15RLMObjectSchemaRN5realm5QueryE + 978 9 Realm 0x0000000105dce460 _Z27RLMUpdateQueryWithPredicatePN5realm5QueryEP11NSPredicateP9RLMSchemaP15RLMObjectSchema + 336 10 Realm 0x0000000105ed515d _ZZ35-[RLMResults objectsWithPredicate:]ENK4$_10clEv + 269 11 Realm 0x0000000105ed2a86 _ZL15translateErrorsIZ35-[RLMResults objectsWithPredicate:]E4$_10EDaOT_P8NSString + 38 12 Realm 0x0000000105ed29f8 -[RLMResults objectsWithPredicate:] + 72 13 RBQFetchedResultsController 0x0000000105cdd5df -[RBQFetchRequest fetchObjects] + 271 14 RBQFetchedResultsController 0x0000000105cd1781 -[RBQFetchedResultsController createStateObjectWithFetchRequest:realm:cache:cacheRealm:] + 1489 15 RBQFetchedResultsController 0x0000000105ccdc50 -[RBQFetchedResultsController calculateChangesWithAddedSafeObjects:deletedSafeObjects:changedSafeObjects:realm:] + 2208 16 RBQFetchedResultsController 0x0000000105ccd1d4 58-[RBQFetchedResultsController registerChangeNotifications]_block_invoke + 1396 17 RBQFetchedResultsController 0x0000000105ce0376 -[RBQRealmNotificationManager sendNotificationsWithRealm:entityChanges:] + 518 18 RBQFetchedResultsController 0x0000000105ce2550 50-[RBQRealmChangeLogger registerChangeNotification]_block_invoke + 256 19 Realm 0x0000000105ec08b9 -[RLMRealm sendNotifications:] + 1065 20 Realm 0x0000000105ecc7fb _ZN12_GLOBALN_121RLMNotificationHelper10did_changeERKNSt3__16vectorIN5realm14BindingContext13ObserverStateENS1_9allocatorIS5_EEEERKNS2_IPvNS6_ISB_EEEE + 107 21 Realm 0x0000000105ef698b _ZN5realm5_impl11transaction6commitERNS_11SharedGroupEPNS_14BindingContextE + 395 22 Realm 0x0000000105eefac8 _ZN5realm5Realm18commit_transactionEv + 456 23 Realm 0x0000000105ec0c95 -[RLMRealm commitWriteTransaction:] + 53 24 Realm 0x0000000105ec0f4e -[RLMRealm transactionWithBlock:error:] + 158 25 RealmSwift 0x00000001063784b1 _TFC10RealmSwift5Realm5writefS0_FzFT_TT + 209 26 XXX 0x000000010528b190 _TZFC6XXX18PersistenceManager3addfMS0_FTC10RealmSwift6Object14fromWriteBlockSb_CS1_5Realm + 480 27 XXX 0x00000001052453f0 _TZFC6XXX7Message11saveMessagefMS0_FTV10SwiftyJSON4JSON10chatThreadCS_10ChatThread_GSqS0 + 7952 28 XXX 0x000000010541e59b _TZFC6XXX7Message23messagesFromAPIResponsefMS0_FCS11APIResponseT + 5755 29 XXX 0x00000001052107b6 _TZFC6XXX14APISyncManagerP33_56FDCEDBD7F938B6203CBE93E62664E123populateMessagesFromAPIfMS0_FCS11APIResponsePSs9AnyObject + 294 30 XXX 0x000000010536359f _TFZFC6XXX9APIClient23performTaskInBackgroundFMS0_FVS_21APIBackgroundableTaskFT_T_U_FCS11APIResponseT + 511 31 XXX 0x000000010535be9c _TPATFZFC6XXX9APIClient23performTaskInBackgroundFMS0_FVS_21APIBackgroundableTaskFT_T_U_FCS11APIResponseT + 172 32 XXX 0x0000000105363297 _TTRXFo_oC6XXX11APIResponse_dTXFo_iS0iT + 23 33 XXX 0x000000010535bf41 _TPATTRXFo_oC6XXX11APIResponse_dTXFo_iS0iT13 + 81 34 XXX 0x0000000105363b30 _TTRXFo_iC6XXX11APIResponse_iTXFo_oS0dT + 32 35 XXX 0x0000000105363c63 _TFFC6XXX9APIClientP33_632183BA90AB5BFCA689BD5720141B8C20handleSocketResponseFS0_FTGSaPSs9AnyObject3ackGSqC22Socket_IO_Client_Swift16SocketAckEmitter__T_U_FTT + 291 36 XXX 0x00000001051f9b67 _TTRXFodTXFdCbdT + 39 37 libdispatch.dylib 0x000000010a835e5d _dispatch_call_block_and_release + 12 38 libdispatch.dylib 0x000000010a85649b _dispatch_client_callout + 8 39 libdispatch.dylib 0x000000010a83c8ec _dispatch_queue_drain + 2215 40 libdispatch.dylib 0x000000010a83be0d _dispatch_queue_invoke + 601 41 libdispatch.dylib 0x000000010a83ea56 _dispatch_root_queue_drain + 1420 42 libdispatch.dylib 0x000000010a83e4c5 _dispatch_worker_thread3 + 111 43 libsystem_pthread.dylib 0x000000010ab8e4de _pthread_wqthread + 1129 44 libsystem_pthread.dylib 0x000000010ab8c341 start_wqthread + 13 ) libc++abi.dylib: terminating with uncaught exception of type NSException