App transport Security has blocked a clearText Http in ios excode


#1

Hello
I am using ionic for ios app. When i run in xcode simulator to send request to server, It show error

Transport security has blocked a cleartext HTTP (http://)
resource load since it is insecure. Temporary exceptions can be
configured via your app’s Info.plist file.

Please help me…


#2

I am also having this issue.

edit: found the (temporary) solution here – iOS 9 Content Loading Problem


#3

Hello Sir,

Thanks for reply. I have solve the problem add (.info) in xcode
like

key>NSAppTransportSecurity
dict>
key>NSAllowsArbitraryLoads
true/>
/dict>


#4

@enamul95 Where did you add ?

<key>NSAppTransportSecurity</key>
<dict>
  <!--Include to allow all connections (DANGER)-->
  <key>NSAllowsArbitraryLoads</key>
      <true/>
</dict>

#5

@enamul95 can you explain the process and help me to resolve the issue


#6

Just add

<key>NSAppTransportSecurity</key>
<dict>
  <!--Include to allow all connections (DANGER)-->
  <key>NSAllowsArbitraryLoads</key>
      <true/>
</dict>

In the plist file in Resource folder of your ios project :smile:


#7

Hi i add this to to the info.plist, but in my case still without work, can you help see my script, maybe it just work with android, i needed to work with IOs.

using UnityEngine;
using System.Collections;
using UnityEngine.UI;

public class LoginSystem : MonoBehaviour {

public enum lMode{login,register};
public lMode LoginMode;

public GUISkin skin;
//login
private string user = “”;
private string pass = “”;
private int boolstatus;
//register
private string name = “”;
private string password = “”;
private string email = “”;

private string Log;
public Texture LogTexture;

public string sceneMap;
[System.Serializable]
public class LoginParameters{
public Text LoginString;
public Text PassString;
public Toggle Remember;
}
[System.Serializable]
public class RegisterParameters{
public Text UserString;
public Text PassString;
public Text EmailString;
}

public LoginParameters LP;
public RegisterParameters RP;

public static int score;
public static string userName;

private string[] ListStrings;

public GameObject LoginM;
public GameObject RegisM;

public Text logText;

void Start () {
boolstatus = PlayerPrefs.GetInt(“bs”);
if (boolstatus == 1) {
LP.Remember.isOn = true;
}else{
LP.Remember.isOn = false;
}
if (LP.Remember.isOn == true) user = PlayerPrefs.GetString (“login”);
}

void Update () {
logText.text = Log;
if (LoginMode == lMode.login) {
LoginM.SetActive(true);
RegisM.SetActive(false);
}else if(LoginMode == lMode.register){
LoginM.SetActive(false);
RegisM.SetActive(true);
}
if (LP.Remember.isOn == true) {
PlayerPrefs.SetString(“login”,user);
boolstatus = 1;
PlayerPrefs.SetInt(“bs”,boolstatus);
}else{
boolstatus = 0;
PlayerPrefs.SetInt(“bs”,boolstatus);
}

}
void OnGUI(){
GUI.skin = skin;
}
void RequestRegister(){
name = RP.UserString.text;
email = RP.EmailString.text;
password = RP.PassString.text;
if (name.Length < 1) {
Log = “Preencha o campo do Usuário.”;
}else{
if(email.Length < 1){
Log = “Preencha o campo do E-Mail.”;
}else{
if(password.Length < 1){
Log = “Preencha o campo da Senha.”;
}else{
WWWForm register = new WWWForm();
register.AddField(“user”,name);
register.AddField(“pass”,password);
register.AddField(“email”,email);
WWW w = new WWW(“http://nfx.comuv.com/register.php”,register);
StartCoroutine(RequestRegisterInformations(w));
}
}
}
}
void RequestLogin(){
user = LP.LoginString.text;
pass = LP.PassString.text;
Log = “”;
if (user.Length < 1) {
Log = “Preencha o campo do usuario”;
}else{
if(pass.Length < 1){
Log = “Preencha o campo da senha”;
}else{
WWWForm login = new WWWForm();
login.AddField(“user”,user);
login.AddField(“pass”,pass);
WWW w = new WWW(“http://nfx.comuv.com/Login.php”,login);
StartCoroutine(RequestLoginInformations(w));
}
}
}
IEnumerator RequestLoginInformations(WWW w){
yield return w;
if (w.error == null) {
Log = w.text;
ListStrings = w.text.Split(’;’);
if(ListStrings[0] == “Bem vindo”){
Log = “Seja " + ListStrings[0] + " " + ListStrings[1] +” ";
userName = ListStrings[1];
}
if(ListStrings[0] == “Bem vindo”){
Application.LoadLevel(sceneMap);
}
}
}
IEnumerator RequestRegisterInformations(WWW w){
yield return w;
if (w.error == null) {
Log = w.text;
if(Log == “Conta criada com sucesso!”){
LP.LoginString.text = RP.UserString.text;
LP.PassString.text = RP.PassString.text;
RP.UserString.text = “”;
RP.EmailString.text = “”;
RP.PassString.text = “”;
LoginMode = lMode.login;
}
}
}
void RegisterMode(){
LoginMode = lMode.register;
}
void LoginMod(){
LoginMode = lMode.login;
}
}