Thread 17: EXC_BAD_ACCESS (code=257, address=0x1) in swift

298 Views Asked by At

This is my func where the crash is occurring:

//KabaSDKThunk.swift
 func isStarted() throws -> NSNumber {
        do {
            try sdk.isStarted() //Crash on this line
            print("thunk getIsStarted")
        } catch {
            print("thunk getIsStarted throws \(error)")
            throw error
        }
        return NSNumber(booleanLiteral: true)
    }
    
//KabaSynchronizationFSM.swift
 func handleStateSynchronizing() {
        if let kabaRegistered = kabaSDK?.isRegistered {
            if kabaRegistered {
                if let started = kabaSDK?.isStartedBool { //Line 118
                    if started {
                        registerSynchronizationDelegate()
                        DispatchQueue.main.async {
                                                   self.kabaSDK?.synchronizeWithBackend()
                                               }

                    } else {
                        send(.reinitializing)
                    }
                }
            } else {
                send(.syncFailed)
            }
        }
    }

extension IKabaSDK {
    var isStartedBool: Bool {
        ((try? isStarted()) != nil) //Line 193
}

This is the thread backtrace:

 thread #17, queue = 'KABA FSM - state machine204895', stop reason =
 EXC_BAD_ACCESS (code=257, address=0x1)
     frame #0: 0x0000000197ec2118 libobjc.A.dylib`objc_retain + 8
     frame #1: 0x000000010df30308
 HyattMobileKey`KabaSDKThunk.isStarted(self=0x000000028015d940) at
 KabaSDKThunk.swift:32:21
     frame #2: 0x000000010df30640 HyattMobileKey`@objc KabaSDKThunk.isStarted() at :0
     frame #3: 0x000000010dd341c8 HyattMobileKey`IKabaSDK.isStartedBool.getter(self=0x000000028015d940)
 at KabaSynchronizationFSM.swift:193:16
     frame #4: 0x000000010dd33fe0 HyattMobileKey`KabaSynchronizationFSM.handleStateSynchronizing(self=0x0000000283670bd0)
 at KabaSynchronizationFSM.swift:118:43
     frame #5: 0x000000010dd33db4 HyattMobileKey`closure #1 in KabaSynchronizationFSM.transitionDispatch(self=0x0000000283670bd0,
 state=synchronizing) at KabaSynchronizationFSM.swift:102:22
     frame #6: 0x000000010dc65df8 HyattMobileKey`thunk for @escaping @callee_guaranteed () -> () at :0
     frame #7: 0x0000000109bc0700 libdispatch.dylib`_dispatch_call_block_and_release + 24
     frame #8: 0x0000000109bc1fc8 libdispatch.dylib`_dispatch_client_callout + 16
     frame #9: 0x0000000109bc9150 libdispatch.dylib`_dispatch_lane_serial_drain + 684
     frame #10: 0x0000000109bc9ddc libdispatch.dylib`_dispatch_lane_invoke + 432
     frame #11: 0x0000000109bd563c libdispatch.dylib`_dispatch_workloop_worker_thread + 852
     frame #12: 0x00000001dba14e10 libsystem_pthread.dylib`_pthread_wqthread + 284

How do I find out where the issue is?

0

There are 0 best solutions below