0

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?

1
  • please check their documentation for the code updates... for sure there will be code updates after long span of time... Commented Jul 4 at 7:14

2 Answers 2

0

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 change logs.

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

-1

As per info here by twilio, they mention

We do not currently support the Carthage package manager and/or CocoaPods.

This means updating pods is not solution. You need to use Swift Package Manager from below link

https://www.twilio.com/docs/conversations/sdk-download-install#swift-package-manager

To install the SDK with Swift Package Manager, add the following dependency to your project:

https://github.com/twilio/conversations-ios

  1. Open your project in Xcode.

  2. Select File > Add Packages...

  3. Enter https://github.com/twilio/conversations-ios into the search field.

  4. Choose the appropriate version and click Add Package .

Not the answer you're looking for? Browse other questions tagged or ask your own question.