调用 bundleManager.getBundleInfoForSelfSync(bundleManager.BundleFlag.GET\_BUNDLE\_INFO\_WITH\_APPLICATION) 发生jscrash,错误信息 Error message:BusinessError 17700101: Bundle manager service is excepted.
代码大致如下
export class Globals {
static init(appContext: common.ApplicationContext) {
Globals.sBundleInfo = bundleManager.getBundleInfoForSelfSync(bundleManager.BundleFlag.GET_BUNDLE_INFO_WITH_APPLICATION)
}
}
export function initOnCreate(appContext: common.ApplicationContext) {
globalThis["__taobao_app__"] = appContext; // 将appcontext放到全局变量区
Globals.init(appContext);
}
export class TaobaoUIAbility extends UIAbility {
onCreate(want: Want, launchParam: AbilityConstant.LaunchParam): void {
initOnCreate(this.context.getApplicationContext());
}
}
1.如果不想crash,那需要加上 try catch,根据错误码进行处理,重试 或者 做其他处理
2.不加try catch,出问题 就会crash