|
4 週之前 | |
---|---|---|
.. | ||
BuglyAgent.cs | 4 週之前 | |
BuglyAgent.cs.meta | 4 週之前 | |
BuglyCallback.cs | 4 週之前 | |
BuglyCallback.cs.meta | 4 週之前 | |
BuglyInit.cs | 4 週之前 | |
BuglyInit.cs.meta | 4 週之前 | |
ReadMe.md | 4 週之前 | |
ReadMe.md.meta | 4 週之前 |
- Modified: 2015.03.28
- Unity Plugin Version: 1.4.3
- iOS SDK Version: 1.4.8+
- Android SDK Version: 1.2.9+
BuglySDK
- Editor
- Android
- iOS -
Bugly.framework
-libBuglyBridge.a
Plugins
- Android
libs
buglyagent.jar
* BuglyPlugins
BuglyAgent.cs
BuglyInit.cs
- Samples
Notes:
BuglyAgent.cs
- Script of interface method
BuglyInit.cs
- Script binding the gameobject to initialize the sdk
Editor
- Scripts to update the xcode project
Bugly.framework
- The sdk for iOS, you could replace it by the latest versionSamples - Sample project of using Bugly Unity Plugin
You can go to the Bugly download the unity plugin and native sdk for iOS or Android.
bugly_unity_*.unitypackage
file and import the scripts into the unity project.
- Select Assets/Plugins into the unity project
- Copy the Android SDK into the unity project
Samples
- Init the sdk in the first loaded script as following
BuglyAgent.InitWithAppId("You App Id")
Bugly.framework
) into the associated Xcode project and add some dependencies libraries.
- Drag the Bugly.framework into the Xcode project and select the copy trigger
- Open the Xcode project configuration window and select the Build Phases tab, add libraries in Link Binary With Libraries as following:
Security.framework
libz.dylib
public class Welcome : MonoBehaviour {
void InitBuglySDK(){
// enable debug log, please set FALSE in Release version.
BuglyAgent.ConfigDebugMode (true);
#if UNITY_IPHONE || UNITY_IOS
BuglyAgent.InitWithAppId ("Your App ID");
#elif UNITY_ANDROID
BuglyAgent.InitWithAppId ("Your App ID");
#endif
// If you do not need call 'InitWithAppId(string)' to initialize the sdk(may be you has initialized the sdk it associated Android or iOS project),
// please call this method to enable c# exception handler only.
BuglyAgent.EnableExceptionHandler ();
}
// Use this for initialization
void Start () {
InitBuglySDK();
}
}
初始化Bugly,传入Bugly网站注册获得的App ID。
启用native code(Obj-C、C/C++、Java)异常、C#异常捕获上报,如果你已经在相应的iOS或Android工程中初始化Bugly,那么你只需调用
BuglyAgent.EnableExceptionHandler
开启C#异常捕获上报即可。
启动C#异常日志捕获上报,默认自动上报级别LogError,那么LogError、LogException的异常日志都会自动捕获上报。
日志级别定义参考LogSeverity : {LogDebug、LogWarning、LogAssert、LogError、LogException}
注册LogCallbackDelegate回调方法, 处理系统的日志。
如果你的应用需要调用Application.RegisterLogCallback(LogCallback)等注册日志回调,你可以使用此方法进行替换。
设置自动上报日志信息的级别,默认LogError,则>=LogError的日志都会自动捕获上报。
日志级别的定义有LogDebug、LogWarning、LogAssert、LogError、LogException等
上报已捕获C#异常,输入参数异常对象,附加描述信息
上报自定义错误信息,输入错误名称、错误原因、错误堆栈等信息
设置用户标识,如果不设置,默认为10000 。
在初始化之后调用
开启本地调试日志打印,默认关闭
注意:在发布版本中请务必关闭调试日志打印功能
修改应用默认配置信息:渠道号、版本、用户标识等。
在初始化之前调用
渠道号默认值为空,
版本默认值
- Android应用默认读取AndroidManifest.xml中的android:versionName
- iOS应用默认读取Info.plist文件中CFBundleShortVersionString和CFBundleVersion,拼接为CFBundleShortVersionString(CFBundleVersion)格式,例如1.0.1(10)
用户标识默认值10000
配置是否在捕获上报C#异常信息后就立即退出应用,避免后续产生更多非预期的C#的异常。
在初始化之前调用
BuglyAgent.cs
BuglyAgent.InitWithAppId
BuglyAgent.LogCallbackDelegate
to replace register Application.LogCallback
BuglyAgent.ReportException(Exception, string)
to report customized c# exceptionBuglyAgent.ReportException (string, string, string)
to report customized errorLogCallbackDelegate
IBugly
EnableExceptionHandler
HandleException
BuglyUnity
exposed答: 如果无法捕获上报C#异常,可以检查下面两项排查:
检查是否有其他存在注册Application.RegisterLogCallback(LogCallback)的逻辑,由于系统默认的LogCallback是单播实现, 所以只能维持一个回调实例,你可以调用BuglyAgent.RegisterLogCallback(BuglyAgent.LogCallbackDelegate)方法来替代日志回调的注册。
检查对应平台的SDK组件是否已集成到项目。
答: 如果遇到此场景,你可以把脚本中调用的InitWithAppId方法使用EnableExceptionHandler替代,并在对应的Android或iOS工程中初始化SDK的组件。
##Contact US
Email: bugly@tencent.com
QQ: 800014972
WeChat: Bugly