HarmonyOS Cannot read property setMissionContinueState of undefined

Error message:Cannot read property setMissionContinueState of undefined  
SourceCode:  
  context.setMissionContinueState(activeState).then(() => {  
    Stacktrace:  
      at setMissionContinueActive (libgeekapp/src/main/ets/utils/utils/WindowUtil.ets:91:5)  
      at aboutToAppear (libgeekapp/src/main/ets/index/IndexPage.ets:23:5)  
      at jump (libgeekapp/src/main/ets/splash/pages/SplashPage.ets:326:5)  
      at anonymous (libgeekapp/src/main/ets/splash/pages/SplashPage.ets:181:15)  
 }

堆栈跳转中在har中调用。

const context = (getContext(this) as common.UIAbilityContext);

context 提示undefined。

HarmonyOS
2024-10-29 10:44:29
浏览
收藏 0
回答 1
待解决
回答 1
按赞同
/
按时间
put_get

​HSP包的context需要调用createModuleContext(‘包名’)才能获取。

let ctx = getContext(this).createModuleContext('包名')

https://developer.huawei.com/consumer/cn/doc/harmonyos-references-V5/js-apis-inner-app-context-V5

因为开启了多个navigation栈导致的​。

分享
微博
QQ
微信
回复
2024-10-29 17:49:49
相关问题
duplicate @Provide property with name userInfo.
1909浏览 • 1回复 待解决
HarmonyOS创建前置广角相机返回undefined
437浏览 • 1回复 待解决
使用fetch报错,fetch undefined
7170浏览 • 2回复 待解决
mysql 默认隔离级别是REPEATABLE-READ
3757浏览 • 1回复 待解决