I've wrapped Swift code with a try-catch but it seems crashes from thrown exceptions still occur. Could it be that an objc exception is not caught by Swift?
do {
try self.session.matchStreamingBuffer(buffer, at: time)
} catch {
...
}
and the crash looks like this:
Fatal Exception: NSInvalidArgumentException
0 CoreFoundation 0x9e88 __exceptionPreprocess
1 libobjc.A.dylib 0x178d8 objc_exception_throw
2 ShazamKit 0x159d0 -[SHMutableSignature appendBuffer:atTime:error:]
3 ShazamKit 0x6d7c -[SHSignatureGenerator appendBuffer:atTime:error:]
4 ShazamKit 0x3968 -[SHSessionDriverSignatureSlot appendBuffer:atTime:error:]
5 ShazamKit 0x10430 -[SHSignatureBuffer flow:time:]
6 ShazamKit 0x2490 -[SHStreamingSessionDriver flow:time:]
7 ShazamKit 0xf784 -[SHSession matchStreamingBuffer:atTime:]
8 Demo 0x17ec24 thunk for @escaping @callee_guaranteed (@guaranteed AVAudioPCMBuffer, @guaranteed AVAudioTime) -> () (<compiler-generated>)
9 AVFAudio 0x48f70 AVAudioNodeTap::TapMessage::RealtimeMessenger_Perform()
10 AVFAudio 0x8044 CADeprecated::RealtimeMessenger::_PerformPendingMessages()
11 AVFAudio 0x47ea8 invocation function for block in CADeprecated::RealtimeMessenger::RealtimeMessenger(applesauce::dispatch::v1::queue)
12 libdispatch.dylib 0x3fdc _dispatch_client_callout
13 libdispatch.dylib 0x746c _dispatch_continuation_pop
14 libdispatch.dylib 0x1aa58 _dispatch_source_invoke
15 libdispatch.dylib 0xb56c _dispatch_lane_serial_drain
16 libdispatch.dylib 0xc214 _dispatch_lane_invoke
17 libdispatch.dylib 0xd4f8 _dispatch_workloop_invoke
18 libdispatch.dylib 0x16e10 _dispatch_workloop_worker_thread
19 libsystem_pthread.dylib 0xdf8 _pthread_wqthread
20 libsystem_pthread.dylib 0xb98 start_wqthread