求助:微信小游戏IOS更新问题 wx.getUpdateManager
微信小游戏IOS更新问题 wx.getUpdateManager。用的是白鹭引擎。
| onUpdateReady | callback | 当新版本下载完成,会进行回调 |
正式版在android 上能回调新的版本,在开发工具上IOS可以模拟版本更新有回调,可是在真机上iphone6,6s,X都检测不到,也没进行强制重启下面为代码
updateManager.onUpdateReady(function(){ wx.setStorage({ key: newVersionKey, data: '1', fail:function() { console.log("存储失败!") removeCache(); }, complete:function() { updateManager.applyUpdate(); console.log("更新完毕,强制重启!"); } }) }); |
newVersionKey 如果新版本下载完成,则会设置为1,在game.js里会重新去 newVersionKey 的值,如果为1,会执行removeCache();把缓存的资源都删除掉,重新从CDN下载。
