POST request not working on device

Hello!

On real devices and in xcode simulator POST request return event.isError. On android and in corona simulator it works fine. Maybe there is some permissions for iOs but in docs I don’t found them, only for android.

Here is code:

local function networkListener(event) if (event.isError) then print("Network error!") else print("RESPONSE: " .. event.response) answer = event.response end end local headers = {} headers["Content-Type"] = "application/x-www-form-urlencoded" headers["Accept-Language"] = "en-US" local login = userEmail local password = userPassword local current\_program = currentProgram local current\_day = currentDay local totalN = total local level = currentLevel local change\_program = programChange local body = 'app\_id=' .. \_APP\_ID .. '&login=' .. login .. '&password=' .. password .. '&current\_program=' .. current\_program .. '&current\_day=' .. current\_day .. '&total=' .. totalN .. '&level=' .. level .. '&change\_program=' .. change\_program local params = {} params.headers = headers params.body = body network.request("http://mydomain/backup", "POST", networkListener, params)

Thank you!

If this is happening on iOS you’re probably are running into ATS issues. Apple will not allow you to http:// URL’s any more. You have to use https://. If you cannot use https:// then you need to add an exception to your build.settings. See:

https://docs.coronalabs.com/guide/hardware/appleATS/index.html

Rob

Thank you!

That is what I need)

Have a nice day!

If this is happening on iOS you’re probably are running into ATS issues. Apple will not allow you to http:// URL’s any more. You have to use https://. If you cannot use https:// then you need to add an exception to your build.settings. See:

https://docs.coronalabs.com/guide/hardware/appleATS/index.html

Rob

Thank you!

That is what I need)

Have a nice day!