【发布时间】:2015-07-09 19:32:18
【问题描述】:
我已经完成了一个 Unity 游戏,我想在 Google Play、Windows Phone 商店和 Windows 8 商店中发布。我正在使用最新版本的 Parse for Unity SDK (1.4.1) 以及最新版本的 Unity Editor (4.6.4p4),包括最后的补丁。
我在我的游戏中实现的 Parse 完美适用于: - Unity 编辑器(所有平台) - Android(在两台设备上部署 apk) - Android(将游戏发布为 alpha,安装在 +8 台设备上) - Windows Phone 8(所有 Windows Phone 模拟器 - 8.0 和 8.1 - x86) - Windows Phone 8(在装有 Visual Studio 2012 for Windows Phone 和 Visual Studio 2013 Community - ARM 的设备上进行调试)
它不适用于: - Windows Phone 8(部署为 Beta) - Windows Phone 8(部署为隐藏版本)
每次我尝试使用 Parse SDK 的任何功能时游戏都会崩溃,不抛出异常,Windows Phone 8 商店没有给我任何崩溃的信息...似乎是程序集加载问题...
我不知道发生了什么,这个问题阻止了我发布我的游戏,我觉得我快疯了......
所以,我制作了一个简单的虚拟应用程序来测试我的解析实现,并且......它有同样的问题......它非常简单:只有一个附加了“Parse Initialize Behaviour”的游戏对象(两者都有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 = "caldofran@email.com";
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(在商店中发布)中无效?
我读过 Unity 错误,它只影响 iOS:http://forum.unity3d.com/threads/unity-5-parse-ios-nsurlerrordomain-error-1012.308569/ 这个错误(通过 SSL 消耗 WWW)会影响 Windows Phone 应用程序吗?
【问题讨论】:
-
有什么想法吗?谁能测试一下这个问题?
-
我对 Parse 或 Unity 一无所知,但应用程序在应用商店中崩溃的一个常见原因是您尝试在安装目录中写入/修改文件。在调试期间允许这样做,但从 Store 部署时不允许这样做。
-
我真的不知道发生了什么,我没有日志,没有例外......什么都没有。我已经向 Parse 团队报告了一个错误,它似乎已被接受为一个错误......
标签: windows-phone-8 parse-platform crash windows-store