Wifi OTA update alamofire upload bin file failed with 1005 error

39 Views Asked by At

Actually i am doing esp32 wifi board OTA update from iOS and Android apps.

After my iOS iPhone device and wifi board in the same network. I can get ipAddress from wifi board(192.168.69.47). Now i have valid bin file in my iOS app to update. I upload bin file using alamofire upload method but it gives error NSURLErrorDomain Code=-1005 "The network connection was lost."

do {
        let url = "http://192.168.69.47/update"
        let fileURL = Bundle.main.url(forResource: "VSAFE_WIFI_08OCT23.ino.esp32", withExtension: "bin")!
        let originalContents = try Data(contentsOf: fileURL)
        sessionManager.upload(originalContents, to: url).response { response in
            print("esp32OTAUpdate_Alamofire response: \(response)")
            
        }
    }
    catch {
        // Couldn't read the file.
    }

Can anyone guid me what's wrong here? or is this proper way to update esp32 wifi board from iOS app?

Thanks in advance.

0

There are 0 best solutions below