Type of expression is ambiguous without more context swift 4.0

13,790

noPrefix is of type Substring, just coerce it to String:

if let data: Data = Data(base64Encoded: String(noPrefix), options: .ignoreUnknownCharacters) {
    ...
}
Share:
13,790

Related videos on Youtube

Uday Babariya
Author by

Uday Babariya

 Stay Hungry  Stay Foolish  Stay anonymous

Updated on June 04, 2022

Comments

  • Uday Babariya
    Uday Babariya almost 2 years

    i am implementing pod 'Socket.IO-Client-Swift'

    but in SocketEngine.swift file i'm getting this error.

     private func handleBase64(message: String) {
                // binary in base64 string
                let noPrefix = message[message.index(message.startIndex, offsetBy: 2)..<message.endIndex]
    
                if let data = Data(base64Encoded: noPrefix, options: .ignoreUnknownCharacters) {
                    client?.parseEngineBinaryData(data)
                }
            }
    

    enter image description here

    thanks in advance!!

    • Leo Dabus
      Leo Dabus over 6 years
      String(noPrefix)