Closed ddanielczyk closed 1 year ago
Thank you for the very detailed report. We'll be investigating this today and hope to get a fix out soon!
Hey @frankus we experienced two similar crashes however it was on v6.0.4.
Background: Updating from v6.0.2 to v6.0.4.
1st crash
2 0 libswiftCore.dylib 0x39b74 _assertionFailure(_:_:file:line:flags:) + 308
3 1 libswiftCore.dylib 0x39e74 _isFastAssertConfiguration() + 102
4 2 [MY AP] . 0xb52960 specialized Backend.register(appCredentials:completion:) + 498 (Apptentive.swift:498)
5 3 [MY AP] 0xb405d8 partial apply for closure #2 in Apptentive.register(with:completion:) + 112 (<compiler-generated>:112)
6 4 [MY AP] 0xb23cb8 thunk for @escaping @callee_guaranteed () -> () + 20 (<compiler-generated>:20)
crash_info_entry_0
2/Users/distiller/project/dd/SourcePackages/checkouts/apptentive-kit-ios/Sources/ApptentiveKit/Backend.swift:142: Fatal error: Mismatched Credentials: Please delete and reinstall the app
2nd crash
20 libswiftCore.dylib 0x37d7c _assertionFailure(_:_:file:line:flags:) + 312
31 libswiftCore.dylib 0x38080 _isFastAssertConfiguration() + 102
42 0xbda4fc Conversation.merge(with:) + 916 (Conversation.swift:916)
53 0xb4aa5c Backend.loadConversation(from:) + 108 (Conversation.swift:108)
64 0xbc411c specialized static CurrentLoader.loadLatestVersion(containerURL:environment:completion:) + 197 (Backend.swift:197)
75 0xb475d4 Backend.protectedDataDidBecomeAvailable(containerURL:cachesURL:environment:) + 1840 (<compiler-generated>:1840)
86 0xb3c4f8 closure #1 in Apptentive.protectedDataDidBecomeAvailable(_:) + 431 (Apptentive.swift:431)
97 0xb23cb8 thunk for @escaping @callee_guaranteed () -> () + 20 (<compiler-generated>:20)
crash_info_entry_0
/Users/distiller/project/dd/SourcePackages/checkouts/apptentive-kit-ios/Sources/ApptentiveKit/Model/Conversation.swift:79: Fatal error: Both new and existing conversations have tokens, but they do not match.
It looks like issue #31’s solution is to update to v6.0.6, however that leads issue #32.
Note: no crashes occurred when updating from v5.3.0 to v6.0.2.
This should be resolved in v6.0.7.
Confirming v6.0.7 resolved the crash. Thank you @frankus
We are migrating our app from 5.3.4 to 6.0.6 and the sdk is not working at all, constant errors about lack of Credentials and no request is actually made to the server.
I have tried to investigate it inside the library and it looks to me, that the flow is following:
And we land in this method:
The
let previousConversation = try loader.loadConversation()
loads a valid conversation from disk (I can see file exist on disk) - but this conversation has no credentials set.Then it calls
try previousConversation.merged(with: self.conversation)
- and get in result a conversation with nil credentials, even thought theself.conversation
had them before merge. So in short - old conversation have no credentials, new conversation have valid credentials, and the merge output instance have no credentials again. (I suspect the issue may be here, so that newer conversation credentials are not applied to older one, when merging).And this output from above is assigned to
self.conversation
- hence from now on, provided app credentials are gone and it's not possible to get the SDK running.NOTE: When doing a clean-install it works fine, so to me it's an issue with migration between old and new lib.
Some logs: