4.75版本 uni-app Error error uni-wifi not found
4.75版本 uni-app Error error uni-wifi not found
| 开发环境 | 版本号 | 项目创建方式 |
|---|---|---|
| Windows | 11 | HBuilderX |
### 操作步骤:
wifi功能
### 预期结果:
wifi功能正常
### 实际结果:
Error: error: uni-wifi not found.
### bug描述:
Error: error: uni-wifi not found.
4.66无此问题
4.66报错:
Error: targetMethod error::java.lang.ClassCastException: uts.sdk.modules.uniWifi.IndexKt$onGetWifiListByJs$1 cannot be cast to kotlin.jvm.functions.Function0
更多关于4.75版本 uni-app Error error uni-wifi not found的实战教程也可以访问 https://www.itying.com/category-93-b0.html
hello , 可以提供一下可以复现的项目吗?
不方便提供,这一句就报错了 uni.startWifi({ complete: e => {} })
uni-wifi 版本为1.0.6
回复 Neglo: 配置 ext - api 了吗?
回复 DCloud_UNI_yuhe: uni-wifi这个插件自己配置了uni-ext-api,算吗。项目里没有配置,第一次听说。
回复 Neglo: 看一下文档:https://uniapp.dcloud.net.cn/api/system/wifi.html#startwifi 按照文档配置好之后还有问题,可以新建一个复现项目,上传到评论区中
回复 DCloud_UNI_yuhe: 我觉得你可能没搞明白,是4.75这个版本的问题。回退到4.66就可以正常使用。
回复 Neglo: 下载一下这个插件到你的项目中:https://ext.dcloud.net.cn/plugin?id=10337
回复 DCloud_UNI_yuhe: 这个是有的,一直都有,用了两三年了
回复 Neglo: 了解了,但是得有个复现的项目我们才能定位问题,我昨天新建个项目引入之后都是正常的,还请你提供一下一个可以复现的项目
回复 DCloud_UNI_yuhe: 4.75版本不能用,回退到4.66版本就可以正常使用,这个信息能get到不?
我这里经过测试4.75 是正常的,如果有什么问题,您看补充一下相关的问题信息
1、不是typescript编译,使用<script> 2、import { WifiOption } from “@/uni_modules/uni-wifi/utssdk/interface”; 没有这行代码
代码比较复杂,我这边不能改成<script lang="ts">去验证
回复 Neglo: 您可以新建一个项目,复现之后发给我就可以了
回复 DCloud_UNI_yuhe: 你好,完全按照你图片上的代码,我这里会报错 TS2307:Cannot find module ‘@/uni_modules/uni-wifi/utssdk/interface’ or its corresponding type declarations.
uni-wifi
代码
我直接发你这个项目,你可以看一下
你看更新一下插件看看是否能解决呢?
Error: targetMethod error::java.lang.ClassCastException: uts.sdk.modules.uniWifi.IndexKt$onGetWifiListByJs$1 cannot be cast to kotlin.jvm.functions.Function0 这个报错依然存在
回复 Neglo: 是怎么出现的?升级4.75 之后重新打基座了吗?
回复 DCloud_UNI_yuhe: uni.offGetWifiList(this.onGetWifiListFun); 这个报错
在你的代码基础上修改的。点击close就报错



