记录一下:打包后的手机网页端识别IOS失败

问题:使用IOS判断错误,在苹果手机上IOS表示返回false。只有真机上会失败,电脑web模拟器没问题
引擎版本:3.8.6
打包:调试模式,手机web版本
机型:Iphone12 pro
平台:苹果自带浏览器
得下面再简单判断一下才行,看了一下源码,正则不是很熟,就没想看

if (window["navigator"] && window["navigator"]["userAgent"]) {
    let info = window["navigator"]["userAgent"];
    info = info.toLowerCase();
    if (info.indexOf("iphone") != -1 || info.indexOf("mac os") != -1) {
        this._isIOS = true;
    }
}

我的网页是这样写的,好用的很

/**
	 * 获取当前得实际运行设备
	 */
	private static _getPracticalPlatform() {
		let platform: string //平台类型
		let curPlatform = navigator.platform
		if (curPlatform == "Win32" || curPlatform == "MacIntel") {
			platform = sys.Platform.DESKTOP_BROWSER
		} else if (curPlatform == "iPhone" || curPlatform == "ipad") {
			platform = sys.Platform.IOS
		} else {
			platform = sys.Platform.ANDROID
		}
		return platform
	}
1赞