用户工具

站点工具


侧边栏



Unity3D中文文档

script:unityengine:classes:crashreport:crashreport

CrashReport 崩溃报告

class in UnityEngine

Description 描述

Holds data for a single application crash event and provides access to all gathered crash reports.
保存单个应用崩溃事件并且提供访问所有崩溃报告的集合。

If compiled with appropriate settings, Unity will try to gather useful information, like location and thread stack traces, when your application crashes. Upon the next application start, if the data gathering was successful, all crash information will be accessible using this API.

如果使用适当的设置,当应用程序崩溃,unity将试图收集有用的信息,如位置和线程堆栈跟踪。当下一个应用程序启动后,如果数据采集成功,所有事故信息将会被该API访问使用。

To enable crash report generation, in iOS player settings set “Script Call Optimization” option to “Fast but no Exceptions”. After you build your Xcode project in Unity, open it and edit trampoline file: Classes/CrashReporter.h. Change ENABLE_CUSTOM_CRASH_REPORTER define from 0 to 1.

启用崩溃报告,在iOS的player settings中的“Script Call Optimization”选项中设置为“Fast but no Exceptions”。当你在unity中创建Xcode文件后,打开该文件并编辑CrashReporter.h(路径:Classes/CrashReporter.h)文件的ENABLE_CUSTOM_CRASH_REPORTER ,将数值0改为1。

Note: this API currently is available only for iOS targets.
注意:当前该API经对于ios对象是可获取的。

See Also: CrashReport.reports.

JavaScript:

// This example shows a list of crash reports (if available),
// and allows you to output crash data to console, or
// delete them.
public class Crashes: MonoBehaviour {
	void OnGUI() {
		var reports = CrashReport.reports;
		GUILayout.Label("Crash reports:");
		foreach (var r in reports) {
			GUILayout.BeginHorizontal();
			GUILayout.Label("Crash: " + r.time);
			if (GUILayout.Button("Log")) {
				Debug.Log(r.text);
			}
			if (GUILayout.Button("Remove")) {
				r.Remove();
			}
			GUILayout.EndHorizontal();
		}
	}
}

C#:

无C#脚本

Static Variables 静态变量

lastReportReturns last crash report, or null if no reports are available.
返回最后的错误报告,如果获取不到报告返回null。
reportsReturns all currently available reports in a new array.
返回当前所有可获取的报告数组。

Variables 变量

textCrash report data as formatted text.
错误报告数据是文本格式。
timeTime, when the crash occured.
当错误发生时的时间。

Public Functions 公共函数

RemoveRemove report from available reports list.
从可获取报告列表移除报告。

Static Functions 静态函数

RemoveAllRemove all reports from available reports list.
从可获取的报告列表移除所有的报告。
script/unityengine/classes/crashreport/crashreport.txt · 最后更改: 2016/08/02 05:27 (外部编辑)