openimsdk / openim-electron-demo

Instant Messaging web desktop
https://openim.io
Apache License 2.0
144 stars 168 forks source link

Hello, I'm encountering an error when logging in after integrating the SDK: "Error invoking initSDK: TypeError: Invalid value used as weak map key." #58

Open bobo999-craate opened 1 month ago

bobo999-craate commented 1 month ago

OpenIM Server Version

是直接运行的命令npm install open-im-sdk-wasm @openim/electron-client-sdk --save

Operating System and CPU Architecture

Windows (AMD)

Deployment Method

Source Code Deployment

Bug Description and Steps to Reproduce

Error invoking initSDK: TypeError: Invalid value used as weak map key

Screenshots Link

你好,这个是git地址https://gitee.com/z-qiaoer/openim-apply.git,运行的话用命令npm run electron:dev;感谢大哥们帮忙解决一下

Bloomingg commented 1 month ago

To integrate the @openim/electron-client-sdk into the Electron main process, follow these steps:

  1. Import the SDK
    Import the SDK in the main process using the require statement:

    const OpenIMSDKMain = require("@openim/electron-client-sdk");
  2. Load the Renderer Script
    Make sure to import your renderer script (render.js) in the main process. This ensures that the renderer script is correctly initialized and ready to communicate with the main process.

  3. API Calls
    Call the API within appropriate lifecycle events or response to specific events. Ensure that the platformID parameter is a numeric value, which is necessary for the API to function correctly.

By following these guidelines, you can ensure a seamless integration of the SDK in your Electron application's main process.