Mobile iOS SDK open ticket using ZDKRequestProvider()



投稿日時:2023年9月15日

Hi there!
I'm trying to create a ticket using ZDKRequestProvider().createRequest() function but I'm having this error 

ZendeskCoreSDK.IdentityCheckInterceptor.IdentityCheckError.identityMismatch


The user is already Identified (as Anonymous) and I'm always get this error which I can't find any documentation about

Example of the code:

import SupportSDK

import ZendeskCoreSDK

func onSubmitTicket() {

        let request = ZDKCreateRequest()

        request.subject = "Incoming Form"

        request.requestDescription = self.text /// text given by inputField

        request.tags = ["test"]

        request.customFields = []

 

        let provider = ZDKRequestProvider()

        provider.createRequest(request, withCallback: self.afterTicketCreation)

}

  

private func afterTicketCreation(response: Any, error: Any?) {

        DispatchQueue.main.async {

            guard error == nil else {

                print(error)

                self.didOpenTicketSuccess.send(false) <------- always stuck here because error "identityMismatch"

                return

            }

            self.didOpenTicketSuccess.send(true)

        }

    }

 

Zendesk SDKs versions from my podfile.lock: 

- ZendeskAnswerBotProvidersSDK (4.0.0):
    - ZendeskSupportProvidersSDK (~> 7.0.0)
  - ZendeskAnswerBotSDK (4.0.0):
    - ZendeskAnswerBotProvidersSDK (~> 4.0.0)
    - ZendeskMessagingSDK (~> 5.0.0)
  - ZendeskChatProvidersSDK (4.0.1)
  - ZendeskChatSDK (4.0.1):
    - ZendeskChatProvidersSDK (~> 4.0.0)
    - ZendeskMessagingSDK (~> 5.0.0)
  - ZendeskCommonUISDK (8.0.0)
  - ZendeskCoreSDK (4.0.0)
  - ZendeskMessagingAPISDK (5.0.0):
    - ZendeskSDKConfigurationsSDK (~> 3.0.0)
  - ZendeskMessagingSDK (5.0.0):
    - ZendeskCommonUISDK (~> 8.0.0)
    - ZendeskMessagingAPISDK (~> 5.0.0)
  - ZendeskSDKConfigurationsSDK (3.0.0)
  - ZendeskSupportProvidersSDK (7.0.0):
    - ZendeskCoreSDK (~> 4.0.0)
  - ZendeskSupportSDK (7.0.0):
    - ZendeskMessagingSDK (~> 5.0.0)
  - ZendeskSupportProvidersSDK (~> 7.0.0)


What is that ZendeskCoreSDK.IdentityCheckInterceptor.IdentityCheckError.identityMismatch error about?
Thank you!


0

2

2件のコメント

Hi Christopher!

This is the code I use to initialize the ZendeskSDK in the AppDelegate's 

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?)

private func setupZendesk() {
        Zendesk.initialize(
            withChannelKey: EnvironmentManager.getValue(key: .zendeskChatChannelId),
            messagingFactory: DefaultMessagingFactory()) { result in
                if case let .failure(error) = result {
                    print("[LOG] ZENDESK Messaging did not initialize.\nError: \(error.localizedDescription)")
                } else {
                    print("[LOG] ZENDESK MESSAGING INITIALIZED!") <----- PRINTING THIS
                }
            }

        ZendeskCoreSDK.Zendesk.initialize(
            appId: EnvironmentManager.getValue(key: .zendeskAppId),
            clientId: EnvironmentManager.getValue(key: .zendeskClientId),
            zendeskUrl: EnvironmentManager.getValue(key: .zendeskUrl)
        )

        Support.initialize(withZendesk: Zendesk.instance)
        AnswerBot.initialize(withZendesk: Zendesk.instance, support: Support.instance!)
        Chat.initialize(accountKey: EnvironmentManager.getValue(key: .zendeskAccountKey))

        let identity = Identity.createAnonymous()
        Zendesk.instance?.setIdentity(identity)
        print("[LOG] ZENDESK INITIALIZED! version: ", Zendesk.version())
    }

 

And this is the function I use to set the user's identity:

func zendeskIdentify() {
        var identity: Identity!

        if let accountKey = user?.zendeskJwtToken {
            Chat.initialize(accountKey: accountKey)
            identity = Identity.createJwt(token: accountKey)
        } else if let owner = userLegal {
            identity = Identity.createAnonymous(
                name: "\(owner.firstName ?? "") \(owner.lastName ?? "")",
                email: owner.email
            )
        } else {
            identity = Identity.createAnonymous(name: "Anonymous")
        }

        print("[LOG] Zendesk identity set!", identity as Any)
        Zendesk.instance?.setIdentity(identity)
    }

 

The SDK's features I need to implement are:

0


Hi Jaume,
 
Can you share the code where you're initializing the SDK (redact the initialization settings values) and setting the identity?

0


サインインしてコメントを残してください。

お探しのものが見つかりませんか?

新規投稿