NSInvalidArgumentException: -[__NSTaggedDate member:]: unrecognized selector sent to instance 0x8000000000000000

I'm getting this error randomly and infrequently.

NSInvalidArgumentException: -[__NSTaggedDate member:]: unrecognized selector sent to instance 0x8000000000000000
Thread 14
0  CoreFoundation          ___exceptionPreprocess
1  libobjc.A.dylib         _objc_exception_throw
2  CoreFoundation          -[NSObject(NSObject) doesNotRecognizeSelector:]
3  CoreFoundation          ____forwarding___
4  CoreFoundation          ___forwarding_prep_0___
5  libswiftCore.dylib      Swift.Set.insert(__owned A) -> (inserted: Swift.Bool, memberAfterInsert: A)
6  Example App             closure #1 () -> () in AlamoFireSession.perform(DataRequest) -> () (AlamoFireSession.swift:826:33)
7  <compiler-generated>    reabstraction thunk helper from @escaping @callee_guaranteed () -> () to @escaping @callee_unowned @convention(block) () -> ()
8  libdispatch.dylib       __dispatch_call_block_and_release
9  libdispatch.dylib       __dispatch_client_callout
10 libdispatch.dylib       __dispatch_lane_serial_drain
11 libdispatch.dylib       __dispatch_lane_invoke
12 libdispatch.dylib       __dispatch_workloop_worker_thread
13 libsystem_pthread.dylib __pthread_wqthread
14 libsystem_pthread.dylib _start_wqthread

from AlamoFireSession.swift, this appears to be what's crashing:


I have multiple NSManagedObjectContexts, and am calling AlamoFireSession.perform(DataRequest) from inside them and from the main thread.

This means that AlamoFireSession.perform(DataRequest) is being called from more than one thread. Could this cause the crash?

Like what if wherever I do this now:


I replace it with this:

let queue = DispatchQueue(label:"all-requests-here")

// and then elsewhere
queue.async {

where the queue object is scoped so as to stick around.

Read more here: https://stackoverflow.com/questions/66996480/nsinvalidargumentexception-nstaggeddate-member-unrecognized-selector-sen

Content Attribution

This content was originally published by spnkr at Recent Questions - Stack Overflow, and is syndicated here via their RSS feed. You can read the original post over there.

%d bloggers like this: