uni-app 使用Uni-Ad广告组件在微信小程序中真机无法显示报错,微信开发者工具效果正常

uni-app 使用Uni-Ad广告组件在微信小程序中真机无法显示报错,微信开发者工具效果正常

示例代码:

<template>  
    <view>  
        <!-- 插屏广告组件 -->  
        <ad-interstitial adpid="1415209056" :loadnext="true" v-slot:default="{loading, error}" @load="onadload"  
            @close="onadclose" @error="onaderror">  
            <button :disabled="loading" :loading="loading">显示广告</button>  
            <view v-if="error">{{error}}</view>  
        </ad-interstitial>  
    </view>  
</template>  

<script setup>  
    /* 引入ali-oss就会导致与广告组件冲突 在开发者工具正常 在真机有报错并无法显示*/  
    /* 可注释掉此行再次运行 在真机查看效果就正常 */  
    /* 原因可能为ali-oss依赖的qs包与广告插件冲突 */  
    import OSS from 'ali-oss';  

    function onadload(e) {  
        console.log('广告数据加载成功');  
    }  

    function onadclose(e) {  
        console.log("onadclose", e);  
    }  

    function onaderror(e) {  
        // 广告加载失败  
        console.log("onaderror: ", e.detail);  
    }  
</script>  

<style lang="scss">  

</style>

操作步骤:

按照附件示例项目运行在微信小程序开发者工具 广告展示正常 点击预览到真机或真机调试 页面报错

预期结果:

在真机也正常显示

实际结果:

在真机报错

bug描述:

已按照uni-ad文档正确注册并申请广告位 已正确在微信小程序引入插件 按照文档实例引入实例代码后 运行在微信开发者工具正常显示广告 在真机调试或预览到真机后 页面控制台打印大量报错

“Error during evaluating file "app.js”
length`must be a positive 32-bit integel TypeError: length`must be a positive 32-bit integerat t.exports (https://usr/appservice.app.js:163:121007)at t.exports (https://usr/appservice.app.js:156:30124)
at 105../(https://usr/appservice.app.js:156:29531)
ati(https://usr/appservice.app.js:144:10679)
at https://usr/appservice.app.js:144:10714at 410.call-bind/callBound”

页面无法正常显示

同类问题帖子

同类问题帖子

原因可能为:ali-oss包内使用了qs的依赖 与广告插件冲突导致的问题

项目信息 版本/方式
产品分类 uniapp/小程序/微信
PC开发环境操作系统 Windows
PC开发环境操作系统版本号 windows 11
HBuilderX类型 正式
HBuilderX版本号 4.24
第三方开发者工具版本号 Stable 1.06.2407110
基础库版本号 3.5.4
项目创建方式 HBuilderX

更多关于uni-app 使用Uni-Ad广告组件在微信小程序中真机无法显示报错,微信开发者工具效果正常的实战教程也可以访问 https://www.itying.com/category-93-b0.html

2 回复

使用你提供的工程没有复现问题,广告插件也没有依赖 微信开发者工具版本号 stable 1.06.2405020 使用iOS真机扫码预览

更多关于uni-app 使用Uni-Ad广告组件在微信小程序中真机无法显示报错,微信开发者工具效果正常的实战教程也可以访问 https://www.itying.com/category-93-b0.html


使用安卓真机扫码预览试下 我这边是安卓真机做的测试

回到顶部