[0]ios下出现laya异常错误没有详细堆栈信息
app项目:有pc,ios和android三端,laya开发的游戏在三端容器上加载运行。
1、ios原生+laya游戏,ios原生做的容器,使用UIWebView加载laya做的h5游戏
问题:ios设备app运行laya游戏js代码报错,ios原生通过window.onerror获取到的信息里没有详细调用堆栈信息,只有错误信息
获取调用堆栈信息代码如下:
config.js里:
window.onerror = function(msg, url, line, column, detail) {
var plat = window["PlatformClass"];
var cls = plat.createClass("ShowAlertController");
var instance = cls.newObject();
instance.call("onError:::::",msg, url, line, column, detail);//js调用ios/oc代码
}
ios/oc代码ShowAlertController.m里:
ios设备在laya游戏js报错时断点信息:
上图中的"stack"属性值就是存放堆栈信息,但是实际没有详细堆栈信息;
2、android获取laya游戏报错信息实现如下:
public class ExpLayaConch5 extends LayaConch5 {//继承LayaNative里的layaair.game.conch.LayaConch5
@Override
public void alertJS(String title, String message, int i) {//message内容就是报错信息,包含详细堆栈信息
在相同的报错情况下,有详细堆栈信息,如下:
3、pc在相同的报错情况下,有详细堆栈信息
1、ios原生+laya游戏,ios原生做的容器,使用UIWebView加载laya做的h5游戏
问题:ios设备app运行laya游戏js代码报错,ios原生通过window.onerror获取到的信息里没有详细调用堆栈信息,只有错误信息
获取调用堆栈信息代码如下:
config.js里:
window.onerror = function(msg, url, line, column, detail) {
var plat = window["PlatformClass"];
var cls = plat.createClass("ShowAlertController");
var instance = cls.newObject();
instance.call("onError:::::",msg, url, line, column, detail);//js调用ios/oc代码
}
ios/oc代码ShowAlertController.m里:
ios设备在laya游戏js报错时断点信息:
上图中的"stack"属性值就是存放堆栈信息,但是实际没有详细堆栈信息;
2、android获取laya游戏报错信息实现如下:
public class ExpLayaConch5 extends LayaConch5 {//继承LayaNative里的layaair.game.conch.LayaConch5
@Override
public void alertJS(String title, String message, int i) {//message内容就是报错信息,包含详细堆栈信息
在相同的报错情况下,有详细堆栈信息,如下:
3、pc在相同的报错情况下,有详细堆栈信息
没有找到相关结果
已邀请:
要回复问题请先登录
1 个回复
lv
赞同来自: