Hi Quinn- I'm not trying to understand why its throwing the ObjC exception (though i wish it was a Swift error, because in the case of the card state, it really is recoverable, I think) - I'm trying to figure out what methods/functions are going to throw exceptions, and how to properly handle it, from a Swift app. Maybe TKSmartCard is not following the guidelines about throwing exceptions?
Another example I just saw today:TKSmartCardSlotManager. slotNames threw this ObjC exception (during awakening from background, seen once):
SIGABRT (#0): Terminating app due to uncaught exception 'NSGenericException', reason: '*** Collection <__NSDictionaryM: 0x300f8c860> was mutated while being enumerated.'.
I'm guessing there's something happening on resuming from background in the framework that is causing a race condition. I notice that in another thread in the crash report there's something suspicious (this is not a method that is publicly available - I don't know how it gets called): 4 CryptoTokenKit 0x00000001cc7d2934 -[TKSmartCardSlotManager setSlotWithName:endpoint:type:reply:] + 276
The question I am asking is about to what extent we are supposed to be writing ObjC wrappers around Frameworks like TKSmartCard instead of calling the TKSmartCard framework functions directly from Swift, since TKSmartCard seems to be throwing some ObjC exceptions in places I find surprising.
P.S. It feels like you are holding up the entire developer ecosystem on your shoulders, I hope your effort it recognized by Apple. Your work here is very much appreciated! :D