HarmonyOS 鸿蒙Next 官方进来挨打,promptAction.openCustomDialog 弹窗错误码 100001 内部错误

发布于 1周前 作者 phonegap100 来自 鸿蒙OS

HarmonyOS 鸿蒙Next 官方进来挨打,promptAction.openCustomDialog 弹窗错误码 100001 内部错误

自定义弹框显示不出来,查了一下午,坑

import { ComponentContent } from ‘@kit.ArkUI’

@Entry
@ComponentV2
struct Index {
@Local
params: DialogParams = new DialogParams(10)

build() {
Column() {
Text(change num=${this.params.num})
.fontSize(30)
.onClick(() => {
this.params.num++ //刷新ui
})
dialogBuilder(this.params) //刷新ui
dialogBuilder1(this.params) //刷新ui

Text(“showDialog”)
.fontSize(30)
.onClick(() => {
let uiContext = this.getUIContext();
let promptAction = uiContext.getPromptAction();

  // 可以显示弹框,但是父组件状态变化弹框不更新 UI !!!
// let commentsDialog = new ComponentContent(
// uiContext,
// wrapBuilder(dialogBuilder),
// this.params //不刷新ui
// );
// promptAction.openCustomDialog(commentsDialog, {
// alignment: DialogAlignment.Center
// });

let result = promptAction.openCustomDialog({
builder: () => {
// sdk报错 100001 !!!
dialogBuilder.bind(uiContext, this.params)
},
backgroundColor: Color.Black,
maskColor: $r(‘app.color.start_window_background’),
autoCancel: false,
})
result.then((id) => {
console.log(dialog=${id});
})
.catch((e: object) => {
//12-19 16:23:36.044 12562-12562 C0390d/AceOverlay com.pijiu…lication I [(100000:100000:scope)] open custom dialog isShowInSubWindow 0
//12-19 16:23:36.275 12562-12562 C03f00/ArkCompiler com.pijiu…lication I WsServer SendReply: {“id”:207,“result”:{“result”:[{“name”:"",“value”:{“type”:“function”,“className”:“Function”,“unserializableValue”:“function ( { [js code] }@684ab3fe”,“description”:“function ( { [js code] }@684ab3fe”,“objectId”:“6”},“writable”:true,“configurable”:true,“enumerable”:true,“isOwn”:true},{“name”:“e”,“value”:{“type”:“object”,“subtype”:“error”,“className”:“Error”,“unserializableValue”:“Error: Internal error. Build custom dialog failed.@55afadc8”,“description”:“Error: Internal error. Build custom dialog failed.@55afadc8”,“objectId”:“7”},“writable”:true,“configurable”:true,“enumerable”:true,“isOwn”:true}]}}
//
//code = “100001”
// message = “Internal error. Build custom dialog failed.”
// stack = “Cannot get SourceMap info, dump raw stack:\n=====================Backtrace========================\n#00 pc 0000000000671da8 /system/lib64/platformsdk/libark_jsruntime.so\n#01 pc 00000000006722bc /system/lib64/platformsdk/libark_jsruntime.so\n#02 pc 00000000002c3240 /system/lib64/platformsdk/libark_jsruntime.so\n#03 pc 000000000016a53c /system/lib64/platformsdk/libark_jsruntime.so\n#04 pc 0000000000169ee8 /system/lib64/platformsdk/libark_jsruntime.so\n#05 pc 00000000001ef8d8 /system/lib64/platformsdk/libark_jsruntime.so\n#06 pc 00000000005669f0 /system/lib64/platformsdk/libark_jsruntime.so\n#07 pc 0000000000532388 /system/lib64/platformsdk/libark_jsruntime.so\n#08 pc 000000000005072c /system/lib64/platformsdk/libace_napi.z.so\n#09 pc 00000000000194a8 /system/lib64/module/libpromptaction.z.so\n#10 pc 0000000000907e48 /system/lib64/platformsdk/libace_compatible.z.so\n#11 pc 0000000000017c48 /system/lib64/chipset-pub-sdk/libeventhandler.z.so\n#12 pc 0000000000028d1c /system/lib64/chipset-pub-sdk/libeven”
console.log(dialog err=${e});
})
})
}
.height(‘100%’)
.width(‘100%’)
}
}

@ObservedV2
class DialogParams {
@Trace
num: number = 0

constructor(num: number) {
this.num = num;
}
}

@Builder
function dialogBuilder(params: DialogParams) {
Column() {
Text(change builder num=${params.num})
.fontSize(30)
.padding(10)
.onClick(() => {
params.num++
})
}
.width(‘100%’)
.height(100)
}

@Builder
function dialogBuilder1($$: DialogParams) {
Column() {
Text(change builder num=${$$.num})
.fontSize(30)
.padding(10)
.onClick(() => {
$$.num++
})
}
}


更多关于HarmonyOS 鸿蒙Next 官方进来挨打,promptAction.openCustomDialog 弹窗错误码 100001 内部错误的实战系列教程也可以访问 https://www.itying.com/category-93-b0.html

3 回复
import { ComponentContent, promptAction } from '@kit.ArkUI'

@Entry
@ComponentV2
struct Index {
  @Local
  params: DialogParams = new DialogParams(10)
  private customDialogComponentId: number = 0

  @Builder
  customDialogComponent() {
    Column() {
      Text('弹窗').fontSize(30)
      Row({ space: 50 }) {
        Button("确认").onClick(() => {
          promptAction.closeCustomDialog(this.customDialogComponentId)
        })
        Button("取消").onClick(() => {
          promptAction.closeCustomDialog(this.customDialogComponentId)
        })
      }
    }.height(200).padding(5).justifyContent(FlexAlign.SpaceBetween)
  }

  build() {
    Column() {
      Text(`change num=${this.params.num}`)
        .fontSize(30)
        .onClick(() => {
          this.params.num++ //刷新ui
        })
      dialogBuilder(this.params) //刷新ui
      dialogBuilder1(this.params) //刷新ui

      Text("showDialog")
        .fontSize(30)
        .onClick(() => {
          let uiContext = this.getUIContext();
          let promptAction = uiContext.getPromptAction();

          // 可以显示弹框,但是父组件状态变化弹框不更新 UI !!!!!!
          // let commentsDialog = new ComponentContent(
          //   uiContext,
          //   wrapBuilder(dialogBuilder),
          //   this.params  //不刷新ui
          // );
          // promptAction.openCustomDialog(commentsDialog, {
          //   alignment: DialogAlignment.Center
          // });

          let result = promptAction.openCustomDialog({
            builder: () => {
              // sdk报错 100001 !!!!!!!
              this.customDialogComponent()
            },
            backgroundColor: Color.Black,
            maskColor: $r('app.color.start_window_background'),
            autoCancel: false,
          })
          result.then((id) => {
            console.log(`dialog=${id}`);

            this.customDialogComponentId = id

          })
            .catch((e: object) => {
              //12-19 16:23:36.044   12562-12562   C0390d/AceOverlay               com.pijiu...lication  I     [(100000:100000:scope)] open custom dialog isShowInSubWindow 0
              //12-19 16:23:36.275   12562-12562   C03f00/ArkCompiler              com.pijiu...lication  I     WsServer SendReply: {"id":207,"result":{"result":[{"name":"","value":{"type":"function","className":"Function","unserializableValue":"function ( { [js code] }@684ab3fe","description":"function ( { [js code] }@684ab3fe","objectId":"6"},"writable":true,"configurable":true,"enumerable":true,"isOwn":true},{"name":"e","value":{"type":"object","subtype":"error","className":"Error","unserializableValue":"Error: Internal error. Build custom dialog failed.@55afadc8","description":"Error: Internal error. Build custom dialog failed.@55afadc8","objectId":"7"},"writable":true,"configurable":true,"enumerable":true,"isOwn":true}]}}
              //
              //code = "100001"
              // message = "Internal error. Build custom dialog failed."
              // stack = "Cannot get SourceMap info, dump raw stack:\n=====================Backtrace========================\n#00 pc 0000000000671da8 /system/lib64/platformsdk/libark_jsruntime.so\n#01 pc 00000000006722bc /system/lib64/platformsdk/libark_jsruntime.so\n#02 pc 00000000002c3240 /system/lib64/platformsdk/libark_jsruntime.so\n#03 pc 000000000016a53c /system/lib64/platformsdk/libark_jsruntime.so\n#04 pc 0000000000169ee8 /system/lib64/platformsdk/libark_jsruntime.so\n#05 pc 00000000001ef8d8 /system/lib64/platformsdk/libark_jsruntime.so\n#06 pc 00000000005669f0 /system/lib64/platformsdk/libark_jsruntime.so\n#07 pc 0000000000532388 /system/lib64/platformsdk/libark_jsruntime.so\n#08 pc 000000000005072c /system/lib64/platformsdk/libace_napi.z.so\n#09 pc 00000000000194a8 /system/lib64/module/libpromptaction.z.so\n#10 pc 0000000000907e48 /system/lib64/platformsdk/libace_compatible.z.so\n#11 pc 0000000000017c48 /system/lib64/chipset-pub-sdk/libeventhandler.z.so\n#12 pc 0000000000028d1c /system/lib64/chipset-pub-sdk/libeven"
              console.log(`dialog err=${e}`);
            })
        })
    }
    .height('100%')
    .width('100%')
  }
}

@ObservedV2
class DialogParams {
  @Trace
  num: number = 0

  constructor(num: number) {
    this.num = num;
  }
}

@Builder
function dialogBuilder(params: DialogParams) {
  Column() {
    Text(`change builder num=${params.num}`)
      .fontSize(30)
      .padding(10)
      .onClick(() => {
        params.num++
      })
  }
  .width('100%')
  .height(100)
}

@Builder
function dialogBuilder1($$: DialogParams) {
  Column() {
    Text(`change builder num=${$$.num}`)
      .fontSize(30)
      .padding(10)
      .onClick(() => {
        $$.num++
      })
  }
}

试下这种方式呢,主要变化是没有使用dialogBuilder.bind(uiContext, this.params)

更多关于HarmonyOS 鸿蒙Next 官方进来挨打,promptAction.openCustomDialog 弹窗错误码 100001 内部错误的实战系列教程也可以访问 https://www.itying.com/category-93-b0.html


这种方式可以显示,但是你的 @Builder 写到组件里面去了,跟组件耦合在一起,我的demo是写在组件外面

针对您提到的HarmonyOS鸿蒙Next系统中promptAction.openCustomDialog弹窗错误码100001(内部错误)的问题,这通常指示着在调用弹窗接口时,系统内部发生了未预料的错误。此类错误可能由多种原因引起,包括但不限于系统bug、API使用不当、资源限制或环境配置错误。

作为IT专家,我理解这类问题对用户体验的影响。但鉴于错误码指向的是系统内部问题,解决它通常需要深入了解具体的应用场景、代码实现以及系统日志。由于无法直接访问您的开发环境和系统日志,我无法提供具体的修复步骤。

建议检查以下几点可能帮助定位问题:

  • 确保API调用符合官方文档要求。
  • 查看系统日志,寻找与错误码相关的更详细的错误信息。
  • 确认系统版本是否支持您正在使用的API,以及是否有相关的系统更新或补丁。

如果问题依旧没法解决请联系官网客服,官网地址是:https://www.itying.com/category-93-b0.html。在那里,您可以获得更专业的技术支持和解决方案。

回到顶部