1amageek/Pring

Crash - Could not cast value of type NSNull to NSDate

nkmrh opened this issue · 3 comments

nkmrh commented

environment

Xcode 9.2
Pring 0.6.3
Firebase 4.8.2
Firestore 0.10.0

problem

Could not cast value of type 'NSNull' (0x10ea9f770) to 'NSDate' (0x10ea9efc8).

Crash on this line

Steps to reproduce:

post.users.remove(user)
post.update()

then after

post.users.insert(user)
post.update()

Log

Thread 0 name:  Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0   libsystem_kernel.dylib        	0x000000018b479014 0x18b45a000 + 126996
1   libsystem_pthread.dylib       	0x000000018b543264 0x18b53e000 + 21092
2   libsystem_c.dylib             	0x000000018b3eda60 0x18b38c000 + 399968
3   libsystem_c.dylib             	0x000000018b3ed9d0 0x18b38c000 + 399824
4   libswiftCore.dylib            	0x0000000100f68f08 _hidden#25636_ + 3084040 (__hidden#25644_:271)
5   libswiftCore.dylib            	0x0000000100f5eacc _hidden#25267_ + 3041996 (__hidden#25314_:185)
6   libswiftCore.dylib            	0x0000000100f5eb44 swift_dynamicCastClass + 3042116 (__hidden#25314_:269)
7   libswiftCore.dylib            	0x0000000100f97644 swift_dynamicCastForeignClass + 3274308 (__hidden#27753_:1067)
8   libswiftCore.dylib            	0x0000000100f625e0 _hidden#25272_ + 3057120 (__hidden#25314_:2892)
9   libswiftCore.dylib            	0x0000000100f608c4 swift_dynamicCast + 3049668 (__hidden#25314_:1613)
10  MyApp                        	0x00000001002f2e14 specialized closure #2 in DataSource.get(with:block:) + 2141716 (DataSource.swift:343)
11  MyApp                        	0x00000001002f4f0c partial apply for closure #2 in DataSource.get(with:block:) + 2150156 (DataSource.swift:0)
12  MyApp                        	0x0000000100312b2c specialized closure #1 in static Document.get(_:block:) + 2272044 (Document.swift:0)
13  MyApp                        	0x000000010031342c partial apply for closure #1 in static Document.get(_:block:) + 2274348 (Document.swift:0)
14  MyApp                        	0x000000010030c584 thunk for @callee_owned (@owned StorageMetadata?, @owned Error?) -> () + 2246020 (Document.swift:0)
15  MyApp                        	0x00000001002348cc __50-[FIRDocumentReference getDocumentWithCompletion:]_block_invoke + 400
16  MyApp                        	0x0000000100234eec __72-[FIRDocumentReference addSnapshotListenerInternalWithOptions:listener:]_block_invoke + 308
17  libdispatch.dylib             	0x000000018b3369e0 0x18b335000 + 6624
18  libdispatch.dylib             	0x000000018b3369a0 0x18b335000 + 6560
19  libdispatch.dylib             	0x000000018b33b5e8 0x18b335000 + 26088
20  CoreFoundation                	0x000000018c42d0c8 0x18c352000 + 897224
21  CoreFoundation                	0x000000018c42ace4 0x18c352000 + 888036
22  CoreFoundation                	0x000000018c35ada4 0x18c352000 + 36260
23  GraphicsServices              	0x000000018ddc5074 0x18ddb9000 + 49268
24  UIKit                         	0x0000000192615c9c 0x1925a1000 + 478364
25  MyApp                        	0x00000001000efbc4 main + 31684 (UIViewController+Extension.swift:9)
26  libdyld.dylib                 	0x000000018b36959c 0x18b365000 + 17820

It seems that snapshot obtained from listener does not contain updatedAt but I had no idea where it was lost.

thank you for your message.

nkmrh commented

cool 🎉