如何解决ios中audio音频无法播放问题?
在ios的浏览器,audio无法正常的播放音频(但是有些ios设备可以正常播放出来),其中有一次报错为Uncaught (in promise) {"name": "NotAllowedError", "message": "The request is not allowed by the user agent or the platform in the current context, possibly because the user denied permission.", "stack": "pl...
1.3k 阅读
自己想了个方法已经ok,在NSUserDefaults增加一个属性在Appdelegate中首先判断有无该属性以确定是不是第一次安装app如果没有则说明是第一次安装app,增加该属性,该属性表示清理缓存的时间,第一次则赋值为系统当前时间。
然后每次开启app时把该时间与当前系统时间比较,如果当前系统时间比该属性大7天则把Cache文件夹remove否则什么都不做。当初的问题在于如何判断是否手机第一次安装app,后来才知道可以判断NSuserdeafults里面是否有自定义的一个属性就能判断是不是第一次安装该app,从而问题得以解决