我已經完成了一個我想在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應用程序嗎?
任何想法?任何人都可以測試此問題嗎 – Caldofran
我對Parse或Unity一無所知,但應用程序崩潰的一個常見原因是如果您嘗試在安裝目錄中編寫/修改文件。這在調試過程中是允許的,但在從應用商店部署時不允許。 –
我真的不知道發生了什麼,我沒有日誌,沒有例外......沒有。我向Parse團隊報告了一個錯誤,它似乎已被接受爲一個錯誤... – Caldofran