Upgrading TwilioConversationsClient cocoaPods raises lot of issues

Upgrading TwilioConversationsClient cocoaPods raises lot of issues

  

We'd used TwilioConversationsClient version 2.0.0 for Chat feature few years before.

Now we're updating the Pod version of TwilioConversationsClient to 4.0.0.

It raises a lot of issues like

Value of type 'TCHMessage' has no member 'mediaSid'

Like this TCHMessage has lot of issues like, it has no member for hasMedia, mediaType, getMediaContentTemporaryUrl

For ex,

func checkAndShowImageExistInCache(selectedMessage: TCHMessage?){
      // check msg is nil then return
      guard let message = selectedMessage else {
          return
      }
      let url = URL.init(string: message.mediaSid!)
      let request = ImageRequest(url: url!)
      if let container = ImageCache.shared[request] {
        self.openSelectedMessage(message: message, urlString: "", downloadedImage: container.image)
          print("cached media SID \(message.mediaSid!)")
          loader.hide()
          return
      }
 }

mediaSid is getting syntax error.

Searched a lot, but no luck. How can I fix this?

Answer

Since your question is on fixing a bunch of errors as a result of updating from one version to another, the best place to look at would be their here.

Apart from that, the next best course of action would be to CMD+OPT+click on each class/delegate to open the header files, and browse through them. This will help you understand what properties and methods are available in each of them.

It will be an arduous process as the versions are quite far apart, which increases the likelihood of a lot of breaking changes. It might be better to simply redo the whole implementation with the latest version, as opposed to attempting to fix the hundreds of errors. Of course, you're in a better position to determine which option would work best for you.

Hope this helps. And wish you all the best

© 2024 Dagalaxy. All rights reserved.