[英]Using ChatSDK with Zendesk iOS Swift
我正在將 ZDCChat 更新為 ChatSDK。 我現在面臨一個問題。
每次我來到聊天屏幕Chat.accountProvider?.observeAccount
,這個觀察者都會告訴我No Agent Available
。 但是代理可以在我的瀏覽器上使用。
第二件事是當我輸入消息並點擊發送時,它沒有顯示在我的聊天屏幕上。
這是代碼。 這是在 AppDelegate 中:
let chatConfiguration = ChatConfiguration()
chatConfiguration.isPreChatFormEnabled = false
let chatAPIConfiguration = ChatAPIConfiguration()
chatAPIConfiguration.department = "Blah"
chatAPIConfiguration.visitorInfo = VisitorInfo(name: "BlahUser", email: "test@test.com", phoneNumber: "")
Chat.instance?.configuration = chatAPIConfiguration;
Chat.initialize(accountKey: "------my key------", queue: .main)
這就是我開始聊天的方式
let chatAPIConfiguration = ChatAPIConfiguration()
chatAPIConfiguration.department = "iOS App"
chatAPIConfiguration.visitorInfo = VisitorInfo(name: nameField.text!, email: emailField.text!, phoneNumber: "")
Chat.instance?.configuration = chatAPIConfiguration;
do {
let chatEngine = try ChatEngine.engine()
let viewController = try Messaging.instance.buildUI(engines: [chatEngine], configs: [])
viewController.view.backgroundColor = Constants.bgColor
self.navigationController?.pushViewController(viewController, animated: true)
} catch {
// handle error
print("error initaiting chat")
}
結束聊天也不起作用,我一直在啟動 Session。
let stateToken = Chat.chatProvider?.observeChatState { (state) in
// Handle logs, agent events, queue position changes and other events
print("My Session status: ", state.chatSessionStatus)
switch state.chatSessionStatus {
case .configuring:
print("COnfiguring")
case .ended:
print("Ended")
case .ending:
print("Ending")
case .initializing:
print("initializing")
case .started:
print("started")
default:
print("Default Case")
}
}
我也有同樣的問題
嘗試評論這一行:
let chatAPIConfiguration = ChatAPIConfiguration()
chatAPIConfiguration.department = "iOS App"
chatAPIConfiguration.visitorInfo = VisitorInfo(name: nameField.text!, email: emailField.text!, phoneNumber: "")
Chat.instance?.configuration = chatAPIConfiguration;
和
chatConfiguration.preChatFormConfiguration = formConfiguration
和
let chatConfiguration = ChatConfiguration()
chatConfiguration.isPreChatFormEnabled = false
let chatAPIConfiguration = ChatAPIConfiguration()
chatAPIConfiguration.department = "Blah"
chatAPIConfiguration.visitorInfo = VisitorInfo(name: "BlahUser", email: "test@test.com", phoneNumber: "")
Chat.instance?.configuration = chatAPIConfiguration;
升級版:
我有同樣的問題,我寫了支持。 他們回復了我很長時間,通信已經進行了將近一個星期。
我決定更詳細地分析,因為這樣的錯誤可能是什么。
我試圖在聊天中發送圖片 - 聊天獲得。
但是,如果您只是寫短信,則不會發送。
然后我決定評論有關用戶的信息,然后一切正常,但是在聊天信息中看不到用戶寫的內容......
如果你們中的任何人發現此問題並遇到問題,請聯系我,我們將共同解決問題。
所以,經過這么多的奮斗。
發現我們不需要這些代碼行:
let chatAPIConfiguration = ChatAPIConfiguration()
chatAPIConfiguration.department = "iOS App"
chatAPIConfiguration.visitorInfo = VisitorInfo(name: nameField.text!, email: emailField.text!, phoneNumber: "")
Chat.instance?.configuration = chatAPIConfiguration;
chatConfiguration.preChatFormConfiguration = formConfiguration
刪除此代碼后,該應用程序運行正常。 我仍在努力尋找如何自定義 UI。
特別感謝@Linyx。 感謝您幫助我找到解決方案。
Saad Ullah,我在網站上的聊天設置中啟用了部門,並且 ios 聊天現在可以工作......你也可以檢查一下嗎?
還原代碼中的更改並嘗試
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.