怎么判断是苹果设备?

小程序 文章 2022-03-29 09:20 0 全屏看文

怎么判断是苹果设备?How can you tell if it's an Apple device?

怎么判断是苹果设备?
wx.getSystemInfo({  success(res) {	if (res.platform == "ios" || res.system.indexOf('os') > 0 || res.system.indexOf('OS') > 0) {        	console.log('苹果')				} else {		console.log('安卓')			}    }})我的代码是这样判断苹果设备的,但是提交审核后,不在苹果中展示的业务,审核员端还是展示出来了,请问正确的判断方式是什么?

wx. getSystemInfo({ success(res) { if (res.platform == "ios" || res.system.indexOf('os') > 0 || res.system. indexOf('OS') > 0) { console. Log ('apple ') } else { console. Log ('android ') } }}) My code judges Apple Devices in this way, but after submitting for audit, the business that is not displayed in apple is still displayed on the auditor side. What is the correct judgment method?

回答:

brave:
  isDev() {    return wx.getSystemInfoSync().platform.toLowerCase().indexOf("devtools") > -1  }  isIOS() {    return wx.getSystemInfoSync().platform.toLowerCase().indexOf("ios") > -1  }  isAndroid() {    return wx.getSystemInfoSync().platform.toLowerCase().indexOf("android") > -1  }  isIPad() {    return wx.getSystemInfoSync().platform.toLowerCase().indexOf("ipad") > -1  }
老张:
initSys: function () {    console.log(app.globalData.systemInfo = wx.getSystemInfoSync())    app.globalData.isIOS = app.globalData.systemInfo.system.substring(0, 3) == 'iOS'  },
鲈鱼🐳:

审核人员用的是真机,还是模拟器?

-EOF-