crisp-im / crisp-sdk-ios

:package: Crisp iOS SDK, add a chat in any iOS app and communicate with your users.
https://docs.crisp.chat/guides/chatbox-sdks/ios-sdk/
Other
45 stars 19 forks source link

Starting chat error in SwiftUI #90

Closed astjohn closed 1 year ago

astjohn commented 1 year ago

Using ios 16.6 and Crisp (2.4.0)

Code looks something like the following:

import Crisp

...

private func configureSdk() {
         CrispSDK.configure(websiteID: "ID IS HERE")
}

...

private func openCrisp() {
          let bottomSheetVC = ChatViewController()
          let viewController = UIApplication.shared.delegate?.window??.rootViewController
          viewController?.present(bottomSheetVC, animated: true, completion: nil)
}

And the bottom sheet loads, but Crisp reports "Error starting chat" with the try again button. Any advice or guidance is appreciated. What are the possible errors that can cause this? Thanks!

nesium commented 1 year ago

Hi @astjohn. Thanks for your report!

There are multiple reasons why this could be happening. Usually you should be seeing a related error message in the Xcode console when running a debug build. Something along the lines of …

[Crisp] Error: Your session is invalid. You cannot access this resource.

Could you please check and share the output here?

Also the code you've posted looks like UIKit code whereas the title says "SwiftUI". In case you're using SwiftUI you should prefer the ChatView over the ChatViewController since the latter might expose some layout issues in a SwiftUI context.

nicolasmarchal commented 1 year ago

Hey, same issue on my side after updating to version 2.4.0 when launching ChatViewController

CrispSDK.configure(websiteID: Constants.crispToken)
rootViewController.present(ChatViewController(), animated: true)
Initialized Crisp SDK (Version 2.4.0).
[Crisp] Error: Les données n’ont pas pu être lues car elles sont introuvables.

when I downgrade to version 2.3.1 everything seems to work again

astjohn commented 1 year ago

@nesium - Unfortunately, no session invalid error. I may have mistyped the title for this issue, but the root cause remains. I guess @nicolasmarchal has validated the bug.

I'll try to downgrade, but it would be very much appreciated if your team could fix this one. Based on the history, it seems this is an ongoing battle that you guys are constantly facing! Thanks!

nesium commented 1 year ago

Hi @nicolasmarchal. Would you mind contacting us over at crisp.chat and share your Website ID and ideally Session ID (you can just copy the URL of the conversation after selecting it in app.crisp.chat) so that we can reproduce this issue?

Edit: I'd invite you to do the same if that's possible, @astjohn.

nesium commented 1 year ago

Luckily I was able to reproduce the issue and believe that it is fixed in 2.4.1. Please give it a try @astjohn, @nicolasmarchal

astjohn commented 1 year ago

@nesium - confirmed. Working now. Thank you for the very quick response. I don't want to be insensitive, but the issue history suggests this is a constant battle. As you're aware, excellent customer support is the cornerstone of a good customer experience. Our fear is that this could creep up on us every time there is an ios update. I'm not sure what the fix was, but how robust is it moving forward? Thanks again!

nesium commented 1 year ago

Glad to hear that the issue is fixed for you @astjohn. You're correct - unfortunately - that this is an issue that came up repeatedly in the past. The cause and fix is usually simple and you can think of it as a migration issue when features were added that introduce changes to the data model. Due to differences in the type systems of the languages used in different parts of our stack these bugs are sometimes hard to eliminate. I understand that this is annoying and we've talked about this internally and are taking steps to mitigate this problem over time. Until this transition is complete you could quickly open the chat after upgrading to a new version to make sure that everything is working as you expect.

astjohn commented 1 year ago

Sounds good. We'll keep an eye on it as well. Thanks @nesium !