apptentive / apptentive-kit-ios

ApptentiveKit SDK for iOS and iPadOS
https://www.apptentive.com
BSD 3-Clause "New" or "Revised" License
6 stars 3 forks source link

CRASH: Conversation.swift line 916 Conversation.merge(with:) #302 #24

Closed NishanthMurugan closed 1 year ago

NishanthMurugan commented 1 year ago

App is crashing in production. Please find the crash log below and help to resolve it.

Crashed: com.apptentive.backend 0 libswiftCore.dylib 0x3820c assertionFailure(:_:file:line:flags:) + 312 1 libswiftCore.dylib 0x38510 isFastAssertConfiguration() + 102 2 ApptentiveKit 0x5c6c0 Conversation.merge(with:) + 916 (Conversation.swift:916) 3 ApptentiveKit 0x461bc Backend.loadConversation(from:) + 108 (Conversation.swift:108) 4 ApptentiveKit 0x794c8 specialized static CurrentLoader.loadLatestVersion(containerURL:environment:completion:) + 197 (Backend.swift:197) 5 ApptentiveKit 0x42d34 Backend.protectedDataDidBecomeAvailable(containerURL:cachesURL:environment:) + 1840 (:1840) 6 ApptentiveKit 0x17dc4 closure #1 in Apptentive.protectedDataDidBecomeAvailable(:) + 431 (Apptentive.swift:431) 7 ApptentiveKit 0x12cc4 thunk for @escaping @callee_guaranteed () -> () + 20 (:20) 8 libdispatch.dylib 0x24b4 _dispatch_call_block_and_release + 32 9 libdispatch.dylib 0x3fdc _dispatch_client_callout + 20 10 libdispatch.dylib 0xb694 _dispatch_lane_serial_drain + 672 11 libdispatch.dylib 0xc214 _dispatch_lane_invoke + 436 12 libdispatch.dylib 0x16e10 _dispatch_workloop_worker_thread + 652 13 libsystem_pthread.dylib 0xdf8 _pthread_wqthread + 288 14 libsystem_pthread.dylib 0xb98 start_wqthread + 8

CaseyApptentive commented 1 year ago

Thanks @NishanthMurugan. Looking into this now. We'll be in touch as soon as possible.

mihaigpm commented 1 year ago

@CaseyApptentive any news regarding this issue?

Same crash happens to us in production, using SDK 6.0.0, on both iOS 15 and 16.

CaseyApptentive commented 1 year ago

@mihaigpm and @NishanthMurugan, I believe we have a workaround while we work on an update to the SDK. Somewhere before registering the Apptentive SDK, you should override the value of the apptentiveAssertionHandler variable to either an empty block, or a block that calls assertionFailure:

apptentiveAssertionHandler = { (message, file, line) in
    assertionFailure(message(), file: file, line: line)
}

The default value of this variable is simply the assertionFailure function, and unfortunately it doesn’t seem to get compiled out in release builds correctly if referenced in this way.

Will you let me know if that frees you up?

We will continue to do more investigation in terms of why the assertion is being triggered in the first place.

frankus commented 1 year ago

We've incorporated the above fix into version 6.0.5, along with a fix that should eliminate the error exposed by the issue.

CaseyApptentive commented 1 year ago

@mihaigpm and @NishanthMurugan are you still experiencing this issue?

This was addressed in 6.0.5 and we have since pushed 6.0.6. Can you give that a try and let us know?

mihaigpm commented 1 year ago

@CaseyApptentive the crash got solved in 6.0.5 and also with the workaround that you posted earlier. Thank you for looking into it fast!

CaseyApptentive commented 1 year ago

Thanks for confirming. Let us know if you need anything else.