1

I have to debug not my project and I see, that TwilioChatClient.chatClient method doesn't execute and I receive memory read failed error EXC_BAD_ACCESS (code=1, address=0x0). I saw similar topic, where advised to update Twilio, but it is installed via framework and I didn't find the instruction how to update twilio framework in the Xcode. Please help me. Here is the code:

/* Initialize client. */

func client(withToken token: String, completion: @escaping (Bool, NSError?) -> Void) {
    let accessManager = TwilioAccessManager(token: token, delegate: self)
    TwilioChatClient.chatClient(withToken: token, properties: nil, delegate: self, completion: { (result, client) in
        var success = false
        var error: NSError? = nil

        if let result = result {
            if result.isSuccessful() {
                if let client = client {
                    self.client = client
                    accessManager?.registerClient(client, forUpdates: { (token) in
                        client.updateToken(token, completion: { (result) in
                            if let error = result?.error {
                                app.alert(error: error)
                            }
                        })
                    })
                    success = true
                }
            }
        }

        if let e = result?.error {
            error = e
        } else {
            error = NSError.with(description: "Ошибка подключения.".localized)
        }

        completion(success, error)
    })
}

After the TwilioChatClient.chatClient line the program goes to the end of the function. Also I receive the chat token for twilio (it is printed in the console)

  • How did you install the Twilio Chat framework to your application? – philnash Jan 15 '18 at 00:22
  • @philnash Framework, as I understood was downloaded from twilio web-site and installed via "Direct Integration". Yesterday I decided to reinstall it using cocoapods. I had to change lot of code, because there is no 'createMessage' method for example. And now the app works, but only on real device. On simulator there is still memory read failed error(( – Sokolova Natalia Jan 15 '18 at 18:06
  • Ok, so what is the current situation? What version of Twilio Chat do you have installed via cocoapods? What is your current code and can you add the complete error message? (You may need to completely edit your question here). – philnash Jan 16 '18 at 00:01
  • I had to update framework and rewrite methods as they were no longer exists in new version of framework. – Sokolova Natalia Jul 11 '18 at 12:24

0 Answers0