2015-04-30 61 views
1

我已经完成了一个我想在Google Play,Windows Phone Store和Windows 8 Store中发布的Unity游戏。我使用最新版本的Parse for Unity SDK(1.4.1)以及最新版本的Unity Editor(4.6.4p4),包括最新的补丁。解析Windows Phone中的Unity崩溃

解析实现我在游戏中取得完美的作品上: - 统一编辑器(所有平台) - 安卓(两个设备上部署APK) - 安卓(发布游戏如α,在+8设备上安装它) - 的Windows Phone 8(所有的Windows Phone模拟器 - 8.0和8.1 - 86) - 的Windows Phone 8(在设备调试与Windows手机和Visual Studio 2013的社区两的Visual Studio 2012 - ARM)

它确实nt工作于: - Windows Phone 8(部署为测试版) - Windows Phone 8(部署为隐藏版)

每当我尝试使用Parse SDK的任何功能时,游戏崩溃,不会引发异常,Windows Phone 8商店不会给我提供有关任何崩溃的信息......似乎是一个程序集加载问题...

我不知道发生了什么,这个问题阻止我发布我的游戏,认为我要疯了...

因此,我做了一个简单的虚拟应用程序来测试我的分析实现,和...它有相同的问题...它非常简单:只附加一个具有“解析初始化行为”的游戏对象(同时设置AppId和.NET密钥)和一个非常简单的脚本:

using UnityEngine; 
using System.Collections; 
using System.Collections.Generic; 
using System.Xml; 
using System.IO; 
using System.Text; 
using System; 
using System.Linq; 
using Parse; 
using System.Threading.Tasks; 


// Demo application script 
public class AppScript : MonoBehaviour 
{ 
    public static string userName = "Caldofran"; 
    public static string userPass = "Password5"; 
    public static string userEmail = "[email protected]"; 
    public static string errAsincrono = ""; 
    public static string log = ""; 

    public static bool bLogin = false; 
    public static bool bSignUp = false; 

    // Use this for initialization 
    void Start() { 

     //Application.runInBackground = true; 

    } 


    GUIStyle ts = new GUIStyle(); 

void OnGUI() 
    { 
      if (GUI.Button(new Rect(10, 100, 100, 30), "Sign Up")) 
       SignUp(userName,userPass, userEmail); 

      if (GUI.Button(new Rect(10, 150, 100, 30), "Login")) 
       Login(userName, userPass); 


       if (GUI.Button(new Rect(10, 200, 100, 30), "Logout")) 
        Logout(); 

     if (GUI.Button(new Rect(10, 300, 100, 30), "Clear Texts")) 
     { 
      errAsincrono = ""; 
      log = ""; 
     } 


      int left = Screen.width - 110; 

      string usrParse = ""; 

      if (AppScript.IsLoggedInParse()) 
       usrParse = ParseUser.CurrentUser.Username; 

      ts.normal.textColor = Color.red; 

      GUI.BeginGroup(new Rect(300, 5, 600, 500)); 
      GUI.Box(new Rect(0, 0, 400, 300), ""); 
      //GUILayout.Label("P: " + mensajeGUI); 
     GUILayout.Label("User Config: " + userName, ts); 
     GUILayout.Label("Pass config: " + userPass, ts); 
     GUILayout.Label("email config: " + userEmail, ts); 
     GUILayout.Label("Logged in parse: " + AppScript.IsLoggedInParse().ToString(), ts); 
      GUILayout.Label("Parse logged user: " + usrParse, ts); 
     GUILayout.Label("Last msg: " + errAsincrono, ts); 
     GUILayout.Label("Last Log: " + log, ts); 

      GUI.EndGroup(); 
    } 

    // Update is called once per frame 
    void Update() { 


     if (bLogin) 
     { 
      bLogin = false; 
      log += " Login Update text"; 
     } 

     if (bSignUp) 
     { 
      bSignUp = false; 
      log += " SignUp Update text"; 
     } 


    } 



    #region Parse 

    public static bool IsLoggedInParse() 
    { 
     bool retorno = false; 
     if ((ParseUser.CurrentUser != null) && (ParseUser.CurrentUser.IsAuthenticated)) 
      retorno = true; 

     return retorno; 
    } 

    public static void SignUp(string userName, string passWord, string email) 
    { 
     var user = new ParseUser() 
     { 
      Username = userName, 
      Password = passWord 
     }; 
     if (string.IsNullOrEmpty(email)) 
      user.Email = ""; 
     else 
      user.Email = email; 

     try 
     { 
      Task signUpTask = user.SignUpAsync().ContinueWith(t=> 
      { 
       if (t.IsFaulted || t.IsCanceled) 
       { 
        // The login failed. Check the error to see why. 
        foreach(var e in t.Exception.InnerExceptions) { 
         ParseException parseException = (ParseException) e; 
         log += parseException.Message + ": CODE: " + parseException.Code.ToString(); 
        } 
        errAsincrono = t.Exception.Message; 
       } 
       else 
       { 
        // Signup was successful. 
        log = "Welcome " + userName; 
        bSignUp = true; 
       } 
      }); 
     } 
     catch (Exception ex) 
     { 
      errAsincrono = "Error: " + ex.Message; 
     } 
    } 

    public static void Login(string user, string pass) 
    { 
     try 
     { 
      ParseUser.LogInAsync(user, pass).ContinueWith(t => 
      { 
       if (t.IsFaulted || t.IsCanceled) 
       { 
        // The login failed. Check the error to see why. 
        foreach(var e in t.Exception.InnerExceptions) { 
         ParseException parseException = (ParseException) e; 
         log += parseException.Message + ": CODE: " + parseException.Code.ToString(); 
        } 
        errAsincrono = t.Exception.Message; 
       } 
       else 
       { 
        // Login was successful. 
        log = "Welcome back " + userName; 
        AppScript.bLogin = true; 
       } 
      }); 
     } 
     catch (Exception ex) 
     { 
      errAsincrono = "Error: " + ex.Message; 
     } 
    } 

    public static void ResetPassword(string email) 
    { 
     if (IsLoggedInParse()) 
     { 
      Task requestPasswordTask = ParseUser.RequestPasswordResetAsync(email); 
      log = "Pass reset ok"; 
     } 
    } 

    public static void Logout() 
    { 

     if (IsLoggedInParse()) 
     { 
      ParseUser.LogOutAsync(); 
      log = "Logged out "; 
     } 
    } 

    #endregion 


} 

任何人都可以试试吗?我做错了什么?为什么这个代码几乎总是工作,但不在Windows Phone中(在商店中发布)?

我读过关于只影响iOS的Unity错误:http://forum.unity3d.com/threads/unity-5-parse-ios-nsurlerrordomain-error-1012.308569/ 这个错误(消耗WWW低谷SSL)会影响Windows Phone应用程序吗?

+0

任何想法?任何人都可以测试此问题吗 – Caldofran

+0

我对Parse或Unity一无所知,但应用程序崩溃的一个常见原因是如果您尝试在安装目录中编写/修改文件。这在调试过程中是允许的,但在从应用商店部署时不允许。 –

+0

我真的不知道发生了什么,我没有日志,没有例外......没有。我向Parse团队报告了一个错误,它似乎已被接受为一个错误... – Caldofran

回答

0

在我的情况下,使用Parse SDK 1.6.1 for Windows。 设置密码属性会引发ArgumentException。 原因是主构建配置和.NET Native工具链。

解决方案1:
在项目的“生成”设置中取消选中“编译.NET本地工具链”。

解决方案2:
创建ParseUser的子类并定义“新”属性用户名和密码。