i have this script, ifor login a registration. In unity works fiine, but publish on Iphone does not work, what could be wrong!
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;
}
}
Does it print out any error in the XCode console log?
You might want to put in more Debug.Log() calls at each stage to narrow down where it is failing.
Please, im not a programer, im using playmaker, can you fix this problem for me.
here is the the Xcode console log
2015-10-15 21:59:13.715 RankingSystem[5482:2167277] → registered mono modules 0x100e55b00
→ applicationDidFinishLaunching()
objc[5482]: pthread_rwlock_rdlock failed (11)
→ applicationDidBecomeActive()
Requesting Resolution: 1080x1920
Init: screen size 1080x1920
Initializing Metal device caps
Initialize engine version: 5.2.0f3 (e7947df39b5c)
Setting up 1 worker threads for Enlighten.
Thread → id: 16e8a7000 → priority: 1
Sorry to say but using scripts from someone else and don’t know what it means. Pretty hard to fix errors. I think you should take some time to learn how to program. It might help you make things in a more creative way.
This is the whole C# language,
Are you perhaps running into the same issue as explained here:
My app works as designed when in the Editor but I have found when I export to IOS the code I use to get a string value from my server just does not work? Here is the bare bones of the code that works fine in Editor which when I run on IOS device the...
Reading time: 1 mins 🕑
Likes: 1 ❤
Sounded like grabbing the latest patch release fixes it.
i pay a freelancer to create this login and registration for me, but now after finish the job, he never answers the questions that i do to him about fix this problem of programming, That why i came here to ask for help.
Nabil_fx:
i pay a freelancer to create this login and registration for me, but now after finish the job, he never answers the questions that i do to him about fix this problem of programming, That why i came here to ask for help.
Still, if you learn to code many you don’t have to pay the freelancer that doesn’t make correct code. Also, do you have any errors in Unity? Fix every error you have. That fixes it 90% of the time
im going to learn but for now, i need to fix this script.
Also, do you have any errors in Unity? Fix every error you have. That fixes it 90% of the time
here the xcode console message.
This script work on Unity and android, bui on IOs just the press button work, but does not make the function.
2015-10-16 10:10:35.340 RankingSystem[5640:2228623] → registered mono modules 0x100ea5b00
→ applicationDidFinishLaunching()
→ applicationDidBecomeActive()
Requesting Resolution: 1080x1920
Init: screen size 1080x1920
Initializing Metal device caps
Initialize engine version: 5.2.0f3 (e7947df39b5c)
Setting up 1 worker threads for Enlighten.
Thread → id: 16e8a7000 → priority: 1
I mean, Go to Unity,
look at the bottom and press play game
dose any thing show up in the log
Yellow?
Red?
or other
none
Do you have different scenes?
3 scene, Login, Game, Ranking
There is a guy how say that to me.
You might want to put in more Debug.Log() calls at each stage to narrow down where it is failing.
Ok,
Do the same for each scene
check if theirs unused scripts in your inspector
And, its almost impossible to fix in Xcode
And yes, he’s very correct
//basically you enter on specific areas
void Start () {
boolstatus = PlayerPrefs.GetInt("bs");
if (boolstatus == 1) {
//Enter on this between the if statements
Debug.Log("BoolStatus = 1");
LP.Remember.isOn = true;
}else{
LP.Remember.isOn = false;
}
if (LP.Remember.isOn == true) user = PlayerPrefs.GetString ("login"); }
i put between in all unused script, here the result. But still not work on iphone
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) {
Debug.Log("BoolStatus = 1");
LP.Remember.isOn = true;
}else{
LP.Remember.isOn = false;
}
if (LP.Remember.isOn == true) user = PlayerPrefs.GetString ("login");
Debug.Log ("LP.Remember.isOn == true");
}
void Update () {
logText.text = Log;
if (LoginMode == lMode.login) {
Debug.Log("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) {
Debug.Log("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) {
Debug.Log("name.Length < 1");
Log = "Preencha o campo do Usuário.";
}else{
if(email.Length < 1){
Debug.Log("email.Length < 1");
Log = "Preencha o campo do E-Mail.";
}else{
if(password.Length < 1){
Debug.Log("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) {
Debug.Log("user.Length < 1");
Log = "Preencha o campo do usuario";
}else{
if(pass.Length < 1){
Debug.Log("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) {
Debug.Log("w.error == null");
Log = w.text;
ListStrings = w.text.Split(';');
if(ListStrings[0] == "Bem vindo"){
Debug.Log("ListStrings[0] == Bem vindo");
Log = "Seja " + ListStrings[0] + " " + ListStrings[1] +" ";
userName = ListStrings[1];
}
if(ListStrings[0] == "Bem vindo"){
Debug.Log("Bem vindo");
Application.LoadLevel(sceneMap);
}
}
}
IEnumerator RequestRegisterInformations(WWW w){
yield return w;
if (w.error == null) {
Debug.Log("w.error == null");
Log = w.text;
if(Log == "Conta criada com sucesso!"){
Debug.Log("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;
}
}
Debug dose nothing to the script but tell you what has run in the script. In Unity, play the game and see do all the things you do in the script , make the account , login, register, do everything. Then on the bottom see if everything has been used. I wouldn’t be focusing on Xcode right now and trying to figure out how things are working.
everything is working, i already teste, in android, and in unity editor, just for iphone does o work. Im getting crazy. In the Iphone i press the button and does not login, still in the same screen. Very strange