OPPO技术号 发表于 2023-7-10 17:31:37

快应用开发常见问题汇总 - oppo

<p .="white-space: normal; line-height: 2em;" style="overflow-wrap: break-word; margin-top: 0px; margin-bottom: 0px; padding: 0px; color: rgb(51, 51, 51); white-space: normal; background-color: rgb(255, 255, 255); text-align: left;"><span style="background-color: rgb(253, 234, 218); color: rgb(127, 127, 127); font-size: 16px;"><em>本帖记录OPPO侧快应用开发常见问题,不定期更新,欢迎阅读</em><em><img src="http://img.baidu.com/hi/face/i_f40.gif"/></em></span></p><p .="white-space: normal; line-height: 2em;" style="overflow-wrap: break-word; margin-top: 0px; margin-bottom: 0px; padding: 0px; color: rgb(51, 51, 51); font-family: Arial, 微软雅黑, &amp;quot;Microsoft Yahei&amp;quot;, 华文细黑, sans-serif; white-space: normal; background-color: rgb(255, 255, 255);"><span style="font-size: 16px;"><strong><br style="text-align: left;"/></strong></span></p><p .="white-space: normal; line-height: 2em;" style="overflow-wrap: break-word; margin-top: 0px; margin-bottom: 0px; padding: 0px; color: rgb(51, 51, 51); white-space: normal; background-color: rgb(255, 255, 255); text-align: left;"><span style="font-size: 16px;"><strong>快应用广告</strong></span></p><p .="white-space: normal; line-height: 2em;" style="overflow-wrap: break-word; margin-top: 0px; margin-bottom: 0px; padding: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-align: left;"><span style="font-size: 16px;"><span style="color: rgb(51, 51, 51); overflow-wrap: break-word; font-weight: 700; font-size: 16px;">&nbsp; &nbsp; </span><span style="overflow-wrap: break-word; font-weight: 700; font-size: 16px;"><a target="_blank"><span style="overflow-wrap: break-word; font-weight: 700; font-size: 16px; color: rgb(51, 102, 153); caret-color: rgb(51, 102, 153);">OPPO快应用广告开发文档</span><span style="overflow-wrap: break-word; font-weight: 700; font-size: 16px; color: rgb(51, 51, 51);">&nbsp;</span></a></span></span></p><p .="white-space: normal; line-height: 2em;" style="overflow-wrap: break-word; margin-top: 0px; margin-bottom: 0px; padding: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-align: left;"><span style="font-size: 16px;">&nbsp; &nbsp;&nbsp;</span></p><p .="white-space: normal; line-height: 2em;"><span style="font-size: 16px;"><span .="color: rgb(160, 82, 45); font-family: 黑体, SimHei;" style="font-size: 16px; overflow-wrap: break-word;">&nbsp;&nbsp;&nbsp;<span style="overflow-wrap: break-word; font-size: 16px;">&nbsp;</span></span><strong><span .="color: rgb(160, 82, 45); font-family: 黑体, SimHei;" style="font-size: 16px; overflow-wrap: break-word;"><span style="font-size: 16px; overflow-wrap: break-word; background-color: rgb(235, 241, 221);">Q. </span><span style="font-size: 16px; overflow-wrap: break-word; background-color: rgb(235, 241, 221);">使</span></span><span .="color: rgb(160, 82, 45); font-family: 黑体, SimHei;" style="font-size: 16px; overflow-wrap: break-word; background-color: rgb(235, 241, 221);">用广告接口时报错:</span></strong><strong><span .="color: rgb(160, 82, 45); font-family: 黑体, SimHei;" style="font-size: 16px; overflow-wrap: break-word; background-color: rgb(235, 241, 221);"></span></strong></span></p><p style="text-align: left;"><span style="font-size: 16px;">&quot;errCode\&quot;:2000,\&quot;errMsg\&quot;.\&quot;&nbsp;the&nbsp;preview
release&nbsp;does&nbsp;not&nbsp;support&nbsp;ad-related&nbsp;features,&nbsp;please&nbsp;use
the&nbsp;corresponding&nbsp;vendor&nbsp;quick-app&nbsp;engine&quot;</span></p><p style="text-align: left;"><span style="font-size: 16px;">&nbsp; &nbsp; A. 请使用OPPO引擎调试广告,详见 </span><a target="_blank" style="text-decoration: underline; font-size: 16px;"><span style="font-size: 16px;"><strong>区分联盟预览版和OPPO内置引擎</strong></span></a><span style="font-size: 16px;">&nbsp;,&nbsp;并保证快应用已经上线。</span></p><p style="text-align: left;"><span style="font-size: 16px;">&nbsp;&nbsp;&nbsp;&nbsp;</span></p><p><span style="font-size: 16px;">&nbsp;&nbsp;&nbsp;&nbsp;<strong><span .="color: rgb(160, 82, 45); font-family: 黑体, SimHei;" style="font-size: 16px; overflow-wrap: break-word; background-color: rgb(235, 241, 221);">Q. 广告1003报错排查:</span></strong><strong><span .="color: rgb(160, 82, 45); font-family: 黑体, SimHei;" style="font-size: 16px; overflow-wrap: break-word; background-color: rgb(235, 241, 221);"></span></strong></span></p><p style="text-align: left;"><span style="font-size: 16px;">&nbsp; &nbsp; A. 1003 无广告返回:</span></p><p class="p1" style="margin-top: 0px; margin-bottom: 0px; font-variant-numeric: normal; font-variant-east-asian: normal; font-stretch: normal; font-size: 13px; line-height: normal; font-family: &amp;quot;Helvetica Neue&amp;quot;; white-space: normal;"><span style="font-size: 16px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="font-size: 16px; font-family: arial, helvetica, sans-serif;">1. 检查是否为OPPO手机,须使用OPPO手机</span></span></p><p class="p1" style="margin-top: 0px; margin-bottom: 0px; font-variant-numeric: normal; font-variant-east-asian: normal; font-stretch: normal; font-size: 13px; line-height: normal; font-family: &amp;quot;Helvetica Neue&amp;quot;; white-space: normal;"><span style="font-size: 16px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="font-size: 16px; font-family: arial, helvetica, sans-serif;">2. 可降低请求频率,间隔10s查看是否正常返回广告</span></span></p><p class="p1" style="margin-top: 0px; margin-bottom: 0px; font-variant-numeric: normal; font-variant-east-asian: normal; font-stretch: normal; font-size: 13px; line-height: normal; font-family: &amp;quot;Helvetica Neue&amp;quot;; white-space: normal;"><span style="font-size: 16px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="font-size: 16px; font-family: arial, helvetica, sans-serif;">3. 检查是否所有类型广告都返回1003,可联系商务处理</span></span></p><p class="p2" style="margin-top: 0px; margin-bottom: 0px; font-variant-numeric: normal; font-variant-east-asian: normal; font-stretch: normal; font-size: 13px; line-height: normal; font-family: &amp;quot;PingFang SC&amp;quot;; white-space: normal;"><span style="font-size: 16px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;<span style="font-size: 16px; font-family: arial, helvetica, sans-serif;">4. 【建议】使用广告预览功能(路径:广告联盟-工具中心-广告预览),将手机IMEI号与广告位ID绑定生成预览信息,再进行广告测试</span></span></p><p class="p2" style="margin-top: 0px; margin-bottom: 0px; font-variant-numeric: normal; font-variant-east-asian: normal; font-stretch: normal; font-size: 13px; line-height: normal; font-family: &amp;quot;PingFang SC&amp;quot;; white-space: normal;"><span style="font-size: 16px;"><span style="font-size: 16px; font-family: arial, helvetica, sans-serif;">&nbsp;&nbsp;&nbsp;&nbsp;</span></span></p><p class="p2" style="margin-top: 0px; margin-bottom: 0px; font-variant-numeric: normal; font-variant-east-asian: normal; font-stretch: normal; font-size: 13px; line-height: normal; font-family: &amp;quot;PingFang SC&amp;quot;; white-space: normal;"><span style="font-family: arial, helvetica, sans-serif; font-size: 16px;"></span></p><p class="p2" style="margin-top: 0px; margin-bottom: 0px; font-variant-numeric: normal; font-variant-east-asian: normal; font-stretch: normal; font-size: 13px; line-height: normal; font-family: &amp;quot;PingFang SC&amp;quot;; white-space: normal;"><span style="font-family: arial, helvetica, sans-serif; font-size: 16px;"></span></p><p><span style="font-size: 16px;">&nbsp;&nbsp;&nbsp;&nbsp;<strong><span style="overflow-wrap: break-word; background-color: rgb(235, 241, 221); font-size: 16px;">Q. 原生广告信息流2.0,点击广告,只有第一次触发了onadclick事件,再次点击无效,这是为什么?</span></strong></span></p><p style="margin-top: 0px; margin-bottom: 0px; padding: 0px; box-sizing: border-box; border: 0px; font-size: 14px; line-height: 1.375rem; overflow-wrap: break-word; font-family: OPPOSans-R, &amp;quot;PingFang SC&amp;quot;, &amp;quot;Microsoft YaHei&amp;quot;, &amp;quot;Helvetica Neue&amp;quot;, Helvetica, Arial, &amp;quot;sans-serif&amp;quot;; white-space: normal; background-color: rgb(255, 255, 255);"><span style="font-size: 16px;">&nbsp;&nbsp;&nbsp;&nbsp;A. 这是广告产品逻辑,adclick 目前是第一次才触发,因为开发者通常是按照回调计算扣费,一个广告重复点击实际只扣费一次。</span></p><p style="margin-top: 0px; margin-bottom: 0px; padding: 0px; box-sizing: border-box; border: 0px; font-size: 14px; line-height: 1.375rem; overflow-wrap: break-word; font-family: OPPOSans-R, &amp;quot;PingFang SC&amp;quot;, &amp;quot;Microsoft YaHei&amp;quot;, &amp;quot;Helvetica Neue&amp;quot;, Helvetica, Arial, &amp;quot;sans-serif&amp;quot;; white-space: normal; background-color: rgb(255, 255, 255);"><span style="font-size: 16px;">&nbsp;&nbsp;&nbsp;&nbsp;</span></p><p class="p2" style="margin-top: 0px; margin-bottom: 0px; font-variant-numeric: normal; font-variant-east-asian: normal; font-stretch: normal; font-size: 13px; line-height: normal; font-family: &amp;quot;PingFang SC&amp;quot;; white-space: normal;"><span style="font-family: arial, helvetica, sans-serif; font-size: 16px;"></span></p><p><strong><span style="font-size: 16px;">&nbsp;&nbsp;&nbsp;&nbsp;<span style="overflow-wrap: break-word; background-color: rgb(235, 241, 221); font-size: 16px;">Q. 原生信息流2.0广告经常报inter error request,detail:,rawError=?</span></span></strong></p><p style="margin-top: 0px; margin-bottom: 0px; padding: 0px; box-sizing: border-box; border: 0px; font-size: 14px; line-height: 1.375rem; overflow-wrap: break-word; font-family: OPPOSans-R, &amp;quot;PingFang SC&amp;quot;, &amp;quot;Microsoft YaHei&amp;quot;, &amp;quot;Helvetica Neue&amp;quot;, Helvetica, Arial, &amp;quot;sans-serif&amp;quot;; white-space: normal; background-color: rgb(255, 255, 255);"><span style="font-size: 16px;">&nbsp;&nbsp;&nbsp;&nbsp;A. 广告服务端的限制,设备级别的频控,建议降低请求广告次数,或者多准备几台手机调试。</span></p><p class="p2" style="margin-top: 0px; margin-bottom: 0px; font-variant-numeric: normal; font-variant-east-asian: normal; font-stretch: normal; font-size: 13px; line-height: normal; font-family: &amp;quot;PingFang SC&amp;quot;; white-space: normal;"><span style="font-family: arial, helvetica, sans-serif; font-size: 16px;"></span></p><p style="text-align: left;"><span style="font-size: 16px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span></p><p style="text-align: left;"><span style="font-size: 16px;">&nbsp;&nbsp;&nbsp;&nbsp;<strong><span style="font-size: 16px; color: rgb(51, 51, 51); background-color: rgb(235, 241, 221);">Q. 广告点击事件只回调了一次,后续点击不生效:</span></strong><strong><span style="font-size: 16px; color: rgb(51, 51, 51); background-color: rgb(235, 241, 221);"></span></strong></span></p><p><span style="font-size: 16px;">&nbsp; &nbsp; A. 非bug,正常广告逻辑。</span></p><p><span style="font-size: 16px;">&nbsp;&nbsp;&nbsp;&nbsp;</span></p><p style="text-align: left;"><span style="font-size: 16px;">&nbsp;&nbsp;&nbsp;&nbsp;<strong><span .="color: rgb(160, 82, 45); font-family: 黑体, SimHei;" style="font-size: 16px; overflow-wrap: break-word; background-color: rgb(235, 241, 221);">Q. &nbsp;【激励视频广告】是否支持在当条视频播放未结束时,提前加载下一条视频广告?</span></strong><strong><span .="color: rgb(160, 82, 45); font-family: 黑体, SimHei;" style="font-size: 16px; overflow-wrap: break-word; background-color: rgb(235, 241, 221);"></span></strong></span></p><p style="text-align: left;"><span style="font-size: 16px;">&nbsp;&nbsp;&nbsp;&nbsp;A. 不支持。需要上一条视频回调了close事件,才能加载下一条视频广告。</span></p><p><span style="font-size: 16px;">&nbsp;&nbsp;&nbsp;&nbsp;</span></p><p style="text-align: left;"><span style="font-size: 16px;">&nbsp;&nbsp;&nbsp;&nbsp;<strong><span .="color: rgb(160, 82, 45); font-family: 黑体, SimHei;" style="font-size: 16px; overflow-wrap: break-word; background-color: rgb(235, 241, 221);">Q. 【激励视频广告】如何获知用户是否已经获取奖励?</span></strong><strong><span .="color: rgb(160, 82, 45); font-family: 黑体, SimHei;" style="font-size: 16px; overflow-wrap: break-word; background-color: rgb(235, 241, 221);"></span></strong></span></p><p style="text-align: left;"><span style="font-size: 16px;">&nbsp;&nbsp;&nbsp;&nbsp;A. 在OPPO6.9版本引擎,对应联盟版本<span style="font-size: 16px; color: rgb(214, 50, 0); background-color: rgb(238, 238, 238);">&nbsp;1117 </span>,激励视频广告onClose() 事件的<span style="font-size: 16px; color: rgb(214, 50, 0); background-color: rgb(238, 238, 238);">&nbsp;isEnded&nbsp;</span>参数即表示用户是否领取了奖励。</span></p><p><span style="font-size: 16px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span></p><p><span style="font-size: 16px;"><strong>组件</strong></span></p><p><span style="font-size: 16px;"><span style="color: rgb(51, 51, 51); font-size: 18px; background-color: rgb(255, 255, 255);"><strong>&nbsp;&nbsp;&nbsp;&nbsp;</strong></span><strong><span .="color: rgb(160, 82, 45); font-family: 黑体, SimHei;" style="font-size: 16px; overflow-wrap: break-word; background-color: rgb(235, 241, 221);">Q. OPPO侧是否已经支持小说组件?</span></strong><strong><span .="color: rgb(160, 82, 45); font-family: 黑体, SimHei;" style="font-size: 16px; overflow-wrap: break-word; background-color: rgb(235, 241, 221);"></span></strong></span></p><p><span style="font-size: 16px;">&nbsp;&nbsp;&nbsp;&nbsp;A. OPPO引擎6.6版本,对应联盟版本<span style="font-size: 16px; color: rgb(214, 50, 0); background-color: rgb(238, 238, 238);"> 1114 </span>开始支持。</span></p><p><span style="font-size: 16px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span></p><p><span style="font-size: 16px;">&nbsp;&nbsp;&nbsp;&nbsp;<strong><span .="color: rgb(160, 82, 45); font-family: 黑体, SimHei;" style="font-size: 16px; overflow-wrap: break-word; background-color: rgb(235, 241, 221);">Q. 【加桌组件】加桌成功后为什么会触发app和页面的onShow生命周期?</span></strong><strong><span .="color: rgb(160, 82, 45); font-family: 黑体, SimHei;" style="font-size: 16px; overflow-wrap: break-word; background-color: rgb(235, 241, 221);"></span></strong></span></p><p><span style="font-size: 16px;">&nbsp;&nbsp;&nbsp;&nbsp;A. 正常系统逻辑。在加桌成功后系统添加桌面图标期间,快应用生命周期会出现暂停,此时就会调用onHide周期,图标添加完成后,快应用状态重新恢复,调用onShow生命周期,请开发者自行适配。</span></p><p><span style="font-size: 16px;">&nbsp;&nbsp;&nbsp;&nbsp;</span></p><p><span style="font-size: 16px;"><strong>接口</strong></span></p><p><span style="font-size: 16px;"><span style="font-size: 20px;"><strong>&nbsp;&nbsp;&nbsp;&nbsp;</strong></span><strong><span .="color: rgb(160, 82, 45); font-family: 黑体, SimHei;" style="font-size: 16px; overflow-wrap: break-word; background-color: rgb(235, 241, 221);">Q. 如何获取跳转快应用时携带的参数?</span></strong><strong><span .="color: rgb(160, 82, 45); font-family: 黑体, SimHei;" style="font-size: 16px; overflow-wrap: break-word; background-color: rgb(235, 241, 221);"></span></strong></span></p><p><span style="font-size: 16px;">&nbsp;&nbsp;&nbsp;&nbsp;A. 通过router.push携带在params字段上的参数,或者deeplink链接携带的的参数,均可以在<span style="font-size: 16px; color: rgb(51, 51, 51); letter-spacing: 0.2px; background-color: rgb(248, 248, 248);">在目标</span>页面中在&nbsp;&nbsp;<span style="font-size: 16px; color: rgb(214, 50, 0); background-color: rgb(238, 238, 238);">&nbsp;public&nbsp;</span>(应用外传参)或<span style="font-size: 16px; color: rgb(214, 50, 0); background-color: rgb(238, 238, 238);">&nbsp;protected&nbsp;</span>(应用内传参)下定义 key 名相同的属性实现获取。</span></p><p><span style="font-size: 16px;">&nbsp;&nbsp;&nbsp;&nbsp;</span></p><p><span style="font-size: 16px;">&nbsp;&nbsp;&nbsp;&nbsp;<strong><span .="color: rgb(160, 82, 45); font-family: 黑体, SimHei;" style="font-size: 16px; overflow-wrap: break-word; background-color: rgb(235, 241, 221);">Q. 在快应用页面运行的情况下,再次跳转该页面,携带的参数没有更新</span></strong><strong><span .="color: rgb(160, 82, 45); font-family: 黑体, SimHei;" style="font-size: 16px; overflow-wrap: break-word; background-color: rgb(235, 241, 221);"></span></strong></span></p><p><span style="font-size: 16px;">&nbsp;&nbsp;&nbsp;&nbsp;A. 需要在<span style="font-size: 16px; color: rgb(214, 50, 0); background-color: rgb(238, 238, 238);">&nbsp;onRefresh&nbsp;</span>生命周期里重新获取新的携带参数。详见</span><a target="_blank" style="text-decoration: underline; font-size: 16px;"><span style="font-size: 16px;"><strong>文档</strong></span></a><span style="font-size: 16px;">内<span style="font-size: 16px; color: rgb(214, 50, 0); background-color: rgb(238, 238, 238);">&nbsp;onRefresh()&nbsp;</span> 介绍。&nbsp; &nbsp;&nbsp;</span></p><p><span style="font-size: 16px;">&nbsp;&nbsp;&nbsp;&nbsp;</span></p><p><span style="font-size: 16px;">&nbsp;&nbsp;&nbsp;&nbsp;<strong><span style="font-size: 16px; color: rgb(51, 51, 51); background-color: rgb(235, 241, 221);">Q. 【account 账号】调用 account.authorize() 报错 &quot;code = 2020003, errMsg=Invalid client&quot;</span></strong><strong><span style="font-size: 16px; color: rgb(51, 51, 51); background-color: rgb(235, 241, 221);"></span></strong></span></p><p><span style="font-size: 16px;">&nbsp;&nbsp;&nbsp;&nbsp;A. 需要先开通账号服务。详见文档 </span><a target="_blank" style="text-decoration: underline; font-size: 16px;"><span style="font-size: 16px;"><strong>OPPO快应用帐号服务开启指南</strong></span></a><span style="font-size: 16px;"><strong> </strong>。</span></p><p><span style="font-size: 16px;">&nbsp;&nbsp;&nbsp;&nbsp;</span></p><p><span style="font-size: 16px;">&nbsp;&nbsp;&nbsp;&nbsp;<strong><span .="color: rgb(160, 82, 45); font-family: 黑体, SimHei;" style="font-size: 16px; overflow-wrap: break-word; background-color: rgb(235, 241, 221);">Q. 如何获取设备安卓版本号?</span></strong><strong><span .="color: rgb(160, 82, 45); font-family: 黑体, SimHei;" style="font-size: 16px; overflow-wrap: break-word; background-color: rgb(235, 241, 221);"></span></strong></span></p><p><span style="font-size: 16px;">&nbsp; &nbsp; A.&nbsp;<span style="font-size: 16px; color: rgb(214, 50, 0); background-color: rgb(238, 238, 238);">&nbsp;device.getInfo() </span>&nbsp;接口。</span></p><p><span style="font-size: 16px;"><span style="font-size: 16px; background-color: rgb(255, 255, 255);">&nbsp;&nbsp;&nbsp;&nbsp;osVersi</span>onNa<span style="font-size: 16px; font-family: arial, helvetica, sans-serif;">me:<span style="font-size: 16px; white-space: pre-wrap; background-color: rgb(255, 255, 255);">获取系统版本字符串。如11,12等;</span></span></span></p><p><span style="font-size: 16px;"><span style="font-size: 16px; font-family: arial, helvetica, sans-serif; white-space: pre-wrap; background-color: rgb(255, 255, 255);">&nbsp;&nbsp;&nbsp;&nbsp;osVersionCod</span><span style="font-size: 16px; font-family: arial, helvetica, sans-serif;"><span style="font-size: 16px; white-space: pre-wrap; background-color: rgb(255, 255, 255);">e:</span><span style="font-size: 16px; background-color: rgb(255, 255, 255); white-space: pre-wrap;">对应关系参考android官方 SDK_INT。</span></span></span></p><p><span style="font-size: 16px;"><span style="font-size: 16px; font-family: arial, helvetica, sans-serif;"><span style="font-size: 16px; background-color: rgb(255, 255, 255); white-space: pre-wrap;">&nbsp;&nbsp;&nbsp;&nbsp;</span></span></span></p><p><span style="font-family: arial, helvetica, sans-serif; font-size: 16px; background-color: rgb(255, 255, 255); white-space: pre-wrap;"></span></p><p><span style="font-family: arial, helvetica, sans-serif; font-size: 16px; background-color: rgb(255, 255, 255); white-space: pre-wrap;"></span></p><p style="white-space: normal;"><span style="font-size: 16px;">&nbsp; &nbsp;&nbsp;<strong><span .="color: rgb(160, 82, 45); font-family: 黑体, SimHei;" style="font-size: 16px; overflow-wrap: break-word; background-color: rgb(235, 241, 221);">Q. 如何获取用户的openId?</span></strong></span></p><p style="white-space: normal;"><span style="font-size: 16px;">&nbsp; &nbsp; A.&nbsp;<span style="font-size: 16px; color: rgb(214, 50, 0); background-color: rgb(238, 238, 238);">&nbsp;account.authorize()&nbsp;</span>&nbsp;接口。</span></p><p style="white-space: normal;"><span style="background-color: rgb(255, 255, 255); font-size: 16px;">&nbsp; &nbsp; 调用时不传scope,即可实现对openid的静默获取。使用该接口的前提是需要开通账号服务。参考文档:<a _src="https://open.oppomobile.com/new/developmentDoc/info?id=12398">https://open.oppomobile.com/new/developmentDoc/info?id=12398</a> </span></p><p style="white-space: normal;">&nbsp;&nbsp;&nbsp;&nbsp;</p><p style="white-space: normal;"><span style="font-size: 16px;">&nbsp;&nbsp;&nbsp;&nbsp;<strong style="font-family: OPPOSans-B; font-size: 1.125rem;"><span .="color: rgb(160, 82, 45); font-family: 黑体, SimHei;" style="font-size: 16px; overflow-wrap: break-word; background-color: rgb(235, 241, 221);">Q. 快应用如何拉起原生应用?</span></strong></span></p><p>&nbsp; &nbsp; A. router.push 接口, uri 参数的格式为 &quot;app:&quot; + app包名<span style="font-size: 16px;"><strong style="font-family: OPPOSans-B; font-size: 1.125rem;"><span .="color: rgb(160, 82, 45); font-family: 黑体, SimHei;" style="font-size: 16px; overflow-wrap: break-word; background-color: rgb(235, 241, 221);"></span></strong></span></p><p>&nbsp;&nbsp;&nbsp;&nbsp;</p><p style="white-space: normal;">&nbsp; &nbsp; <strong style="font-family: OPPOSans-B; font-size: 1.125rem;"><span .="color: rgb(160, 82, 45); font-family: 黑体, SimHei;" style="font-size: 16px; overflow-wrap: break-word; background-color: rgb(235, 241, 221);">Q. 如何拉起默认浏览器打开某个链接?</span></strong></p><p>&nbsp; &nbsp; A. router.push 接口, uri 参数的格式为 &#39;&#39;heytapbrowser://webpage/view?url=&quot;&nbsp;+ encode之后的链接。</p><p>&nbsp;&nbsp;&nbsp;&nbsp;</p><p>&nbsp;&nbsp;&nbsp;&nbsp;<strong style="font-family: OPPOSans-B; font-size: 1.125rem;"><span .="color: rgb(160, 82, 45); font-family: 黑体, SimHei;" style="font-size: 16px; overflow-wrap: break-word; background-color: rgb(235, 241, 221);">Q.&nbsp;system.file、system.storage 接口写入文件是否有大小限制</span></strong></p><p>&nbsp; &nbsp; A.&nbsp;system.file、system.storage 接口写入文件均无大小限制</p><p>&nbsp;&nbsp;&nbsp;&nbsp;</p><p style="white-space: normal;">&nbsp; &nbsp; <strong style="font-family: OPPOSans-B; font-size: 1.125rem;"><span .="color: rgb(160, 82, 45); font-family: 黑体, SimHei;" style="font-size: 16px; overflow-wrap: break-word; background-color: rgb(235, 241, 221);">Q</span></strong><strong style="font-family: OPPOSans-B; font-size: 1.125rem;"><span .="color: rgb(160, 82, 45); font-family: 黑体, SimHei;" style="font-size: 16px; overflow-wrap: break-word; background-color: rgb(235, 241, 221);">.&nbsp;system.file、system.storage 接口写入的文件,清缓存后都会被删除吗</span></strong></p><p>&nbsp; &nbsp; A. 会。ystem.file写文件只能写到internal:// 下,internal 都是跟应用绑定的路径,一旦快应用清除缓存,对应的路径都会被删除掉</p><p style="white-space: normal;">&nbsp;&nbsp;&nbsp;&nbsp;</p><p><span style="font-size: 16px;"><strong>框架配置</strong></span></p><p><span style="font-size: 16px;">&nbsp; &nbsp;&nbsp;<strong><span style="font-size: 16px; color: rgb(51, 51, 51); background-color: rgb(235, 241, 221);">Q. 调用 this.$page.setSecure(tr</span><span style="font-size: 16px; color: rgb(214, 50, 0); background-color: rgb(238, 238, 238);"></span><span style="font-size: 16px; color: rgb(51, 51, 51); background-color: rgb(235, 241, 221);">ue) 不生效,仍可截屏和录屏</span></strong><strong><span style="font-size: 16px; color: rgb(51, 51, 51); background-color: rgb(235, 241, 221);"></span></strong></span></p><p><span style="font-size: 16px;">&nbsp;&nbsp;&nbsp;&nbsp;A. OPPO 暂不至此此特性。</span></p><p><span style="font-size: 16px;">&nbsp;&nbsp;&nbsp;&nbsp;</span></p><p><span style="font-size: 16px;">&nbsp;&nbsp;&nbsp;&nbsp;<strong><span style="font-size: 16px; color: rgb(51, 51, 51); background-color: rgb(235, 241, 221);">Q. 如何自行适配暗色模式?</span></strong><strong><span style="font-size: 16px; color: rgb(51, 51, 51); background-color: rgb(235, 241, 221);"></span></strong></span></p><p><span style="font-size: 16px;">&nbsp;&nbsp;&nbsp;&nbsp;A. 在manifest文件中配置<span style="font-size: 16px; color: rgb(214, 50, 0); background-color: rgb(238, 238, 238);">&nbsp;themeMode&nbsp;</span>为 -1(跟随系统主题模式),在页面中通过<span style="font-size: 16px; color: rgb(214, 50, 0); background-color: rgb(238, 238, 238);">&nbsp;onConfigurationChanged(1060+) </span>生命周期监听系统主题模式的变化,从而在代码逻辑中去适配不同颜色的方案即可。若想取消部分组件的自动返色,设置组件上的<span style="font-size: 16px; color: rgb(214, 50, 0); background-color: rgb(238, 238, 238);">&nbsp;forceDark=&quot;f</span></span></p><p><span style="font-size: 16px;"><span style="font-size: 16px; color: rgb(214, 50, 0); background-color: rgb(238, 238, 238);">alse&quot;&nbsp;</span>即可。</span></p><p><span style="font-size: 16px;"></span></p><p>&nbsp;&nbsp;&nbsp;&nbsp;<span style="font-size: 16px;"><strong><span style="font-size: 16px; color: rgb(51, 51, 51); background-color: rgb(235, 241, 221);">Q. 如何让页面滚动指定长度的px</span></strong></span></p><p><span style="font-size: 16px;">&nbsp;&nbsp;&nbsp;&nbsp;A. 若需要页面滚动指定长度的px,即 this.$page.scrollBy() , top 传入 「需滚动长度的px」 * (screenWidth/designWidth) </span></p><p><span style="font-size: 16px;"></span></p><p><span style="font-size: 16px;"></span></p><p style="white-space: normal;">&nbsp;&nbsp;&nbsp;&nbsp;<strong><span style="color: rgb(51, 51, 51); background-color: rgb(235, 241, 221);">Q. 如何让页面滚动指定长度的px</span></strong></p><p style="white-space: normal;">&nbsp;&nbsp;&nbsp;&nbsp;A.&nbsp;若需要页面滚动指定长度的px,即 this.$page.scrollBy() , top 传入 「需滚动长度的px」 * (screenWidth/designWidth)</p><p>&nbsp;&nbsp;&nbsp;&nbsp;</p><p>&nbsp;&nbsp;&nbsp;&nbsp;<strong><span style="color: rgb(51, 51, 51); background-color: rgb(235, 241, 221);">Q.&nbsp;on</span></strong><strong><span style="color: rgb(51, 51, 51); background-color: rgb(235, 241, 221);"></span></strong><strong><span style="color: rgb(51, 51, 51); background-color: rgb(235, 241, 221);">PageScroll 生命周期返回的 scrollTop 不准确?</span></strong></p><p>&nbsp;&nbsp;&nbsp;&nbsp;A. 并非不准确,而是scrollTop的值,根据 screenWidth/designWidth 进行了缩放。</p><p><span style="font-size: 16px;">&nbsp;&nbsp;&nbsp;&nbsp;</span></p><p><span style="font-size: 16px;"></span></p><p><span style="font-size: 16px;"><strong>其他</strong></span></p><p><span style="font-size: 16px;">&nbsp;&nbsp;&nbsp;&nbsp;<strong><span style="font-size: 16px; color: rgb(51, 51, 51); background-color: rgb(235, 241, 221);">Q. 新版快应用卡片调试工具:</span></strong></span></p><p><span style="font-size: 16px;">&nbsp;&nbsp;&nbsp;&nbsp;A. 支持在负一屏的卡片中心添加卡片,欢迎使用:</span><a _src="https://open.oppomobile.com/new/developmentDoc/info?id=12287" style="font-size: 16px; text-decoration: underline;"><span style="font-size: 16px;">https://open.oppomobile.com/new/developmentDoc/info?id=12287</span></a><span style="font-size: 16px;">&nbsp;&nbsp;&nbsp;&nbsp; </span></p>
页: [1]
查看完整版本: 快应用开发常见问题汇总 - oppo