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.
1783浏览 • 1回复 待解决
HarmonyOS创建前置广角相机返回undefined
318浏览 • 1回复 待解决
使用fetch报错,fetch undefined
7038浏览 • 2回复 待解决
如何获取单例为undefined
324浏览 • 1回复 待解决
openssl库编译会报undefined symbol: __errno
979浏览 • 1回复 待解决
undefined symbol napi_create_threadsafe_function
4332浏览 • 1回复 待解决