IOS退出小程序後再進入會卡死
发布于 5 年前 作者 yuanyong 13386 次浏览 来自 问答

1、第一次進入  調用 wx.openBluetoothAdapter  正常

2、用  <navigator class=“leave-btn” open-type=“exit” target=“miniProgram” @tap=“alreadyLeave>已離場</navigator> 退出小程序


3、再次打開進入  卡死了, 無法 調用 this.initBluetooth() 裡面的 wx.openBluetoothAdapter 


onShow() {

    this.getAppAuth()

    console.log('start up on show ', moment().format(‘YYYY-MM-DD HH:mm:ss’))

    if (this.init === false) {

      // 預防進入兩次,小程序機制bug

      this.init = true

      const value = wx.getStorageSync(‘WXOpenId’)

      console.log('value ', value)

      if (value) {

        globalStore.wxOpenId = value

      }

      if (globalStore.wxOpenId === ‘’){

        getToken(this.loginWX(), this.getTokenSuccess, this.getTokenFail);

      }

      else{

        wx.getSystemInfo({

          success: res => {

            console.log(‘model:’ + res.model)

            console.log(‘pixelRatio:’ + res.pixelRatio)

            console.log(‘windowWidth:’ + res.windowWidth)

            console.log(‘windowHeight:’ + res.windowHeight)

            console.log(‘language:’ + res.language)

            console.log(‘version:’ + res.version)

            console.log(‘platform:’ + res.platform)

            globalStore.phoneSystem = res.platform

            globalStore.phoneSystemVersion = res.version

            if(globalStore.phoneSystem === ‘devtools’){

              globalStore.devParkType === ‘1’ ? this.isMarkLocation() : wx.redirectTo({ url: ‘confirm-info’ })

            }

            else{

              this.initBluetooth()

            }

          },

          fail: res => {

            // curThis.bleError = res.errCode + ’ ’ + res.errMsg;

          }

        })

      }

    }

  }

2 回复

麻烦提供出现问题的具体机型、微信版本号、系统版本号,以及能复现问题的代码片段(https://developers.weixin.qq.com/miniprogram/dev/devtools/minicode.html

model:iPhone 7<iPhone9,1>

pixelRatio:2

windowWidth:375

windowHeight:667

language:zh_CN

version:7.0.4

platform:ios

我用了WEPY,代碼片段怎麼搞?

回到顶部