setStorage fail
发布于 6 年前 作者 qiangshi 12964 次浏览 来自 问答

```

toChat: function ({ currentTarget }) {

           const { userid: otherUserID } = currentTarget.dataset;

           const { postId, viewerId } = this.data;

           this._createConversation(otherUserID, postId);

           if (!this.data.isChatted) {

               wx.getStorage({

                   key: `${postId}_viewer`,

                   success: res => {

                       wx.setStorage({

                           key: `${this.data.postId}_viewer`,

                           data: {

                               …res.data,

                               [viewerId]: true,

                           },

                           success: () => {

                               setTimeout(() => {

                                   this.setData({

                                       isChatted: true,

                                   });

                               }, 1500);

                           },

                           fail: e => {

                               throw new Error(e);

                           },

                       });

                   },

                   fail: e => {

                       throw new Error(e);

                   },

               });

           }

       },

```

我们在一台iphone x max 上得到这个报错,在其他人的手机上正常,请问可能是什么问题,该如何解决

3 回复

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

+1 同样的问题

回调里不要再用this了,先在回调外面let that=this

回到顶部