Legacy Dev Forum Posts

 View Only

Sign Up

Chat View Controller appears to be blank and transparent

  • 1.  Chat View Controller appears to be blank and transparent

    Posted 06-05-2025 18:38

    Fogmeister | 2024-10-07 12:27:28 UTC | #1

    Hi,

    Just following the getting started docs to try and get the chat showing in app... https://developer.genesys.cloud/commdigital/digital/webmessaging/mobile-messaging/messenger-mobile-sdk/ios/

    I have the view controller here...

    import UIKit
    import GenesysCloud
    
    class GenesysChatViewController: UIViewController {
        var chatController: ChatController!
        var chatVC: UINavigationController!
            
        override func viewDidLoad() {
            super.viewDidLoad()
            
            let messengerAccount = MessengerAccount(
                deploymentId: "<REDACTED>",
                domain: "eu-west-2",
                logging: true
            )
            
            chatController = ChatController(account: messengerAccount)
            chatController.delegate = self
        }
    
        @objc func dismissChat(_ sender: UIBarButtonItem?) {
            chatController.terminate()
        }
    }
    
    extension GenesysChatViewController: ChatControllerDelegate {
        func shouldPresentWelcomeMessage() -> Bool {
            true
        }
        
        func shouldPresentChatViewController(_ viewController: UINavigationController!) {
            viewController.modalPresentationStyle = .overFullScreen
            present(viewController, animated: true) {
                viewController.viewControllers.first?.navigationItem.leftBarButtonItem = UIBarButtonItem(
                    title: "End Chat",
                    style: .plain,
                    target: self,
                    action: #selector(GenesysChatViewController.dismissChat(_:))
                )
            }
        }
    
        func didFailWithError(_ error: GCError!) {
            print(error.error.debugDescription)
        }
    }

    And when I present or show this view controller I get an empty/transparent view pushed and the associated shouldPresentChatViewController function doesn't seem to be called.

    Please could you advise on where I'm going wrong.

    Thanks


    Fogmeister | 2024-10-07 13:54:50 UTC | #2

    Oh! I keep hitting the didFailWithError function. With the error...

    "Exception in http request: Error Domain=NSURLErrorDomain Code=-1003 "A server with the specified hostname could not be found."

    With the URL...

    https://api-cdn.eu-west-2/webdeployments/v1/deployments/<REDACTED>/config.json

    I think maybe the domain is wrong? But I'm not sure where to get the domain from?

    Thanks


    tamasi878 | 2024-10-07 14:11:52 UTC | #3

    Hi,

    If you check the url, you have inserted in your comment, it is

    https://api-cdn.eu-west-2

    It seems you are missing some .com or other country code, right?


    Fogmeister | 2024-10-07 14:15:41 UTC | #5

    Solved, thanks.

    We're using euw2.pure.cloud


    tamasi878 | 2024-10-07 14:21:18 UTC | #6

    Great. Thank you for the feedback.


    system | 2024-11-06 14:24:11 UTC | #8

    This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.


    This post was migrated from the old Developer Forum.

    ref: 29736