javascript - ios does not execute the js method of WeChat callback, but the Android machine has no problem. Why and how to solve it?
仅有的幸福
仅有的幸福 2017-05-16 13:02:14
0
3
670
wx.onMenuShareTimeline({

      title: shareData.title, // Share title

      link: shareData.link, // Share link

      imgUrl: shareData.imgUrl, // Share icon

      success: function () {

          alert(123);


      },

      cancel: function () {

         

      }

  });

The ios callback success method does not execute, the cancel method executes with no problem, and the Android machine has no problem. Can anyone explain why? How to solve it

仅有的幸福
仅有的幸福

reply all(3)
阿神

It’s not a problem of non-execution, it’s that the alert is blocked on iOS, so if you want to prompt something, you can only use js to control p to pop up the prompt box.

我想大声告诉你

It may not be the reason for iOS and Android systems.
The difference may be caused by the different WeChat versions of the two mobile phones.

Recently regarding sharing, WeChat has upgraded to the latest version and has strict requirements on shared links, which must be page links under JS secure domain names.

If it is not the above problem, you can

wx.config({
    debug: true, // 开启调试模式,
})
查找具体原因。
刘奇

Whether the web address and the shared address are in the same domain

I ate a lot of shit a few days ago because of this. . . .
For example, if your html is at http://abc.com/index.html, then those sharing links must also be under the same domain name

If different domains: Some machines are normal and some are abnormal.

(And the most important thing is: WeChat’s development documentation has two versions, one version points out this, one does not point it out, it’s simply wonderful. According to the code given in your problem description, it is the latter, I guess I’ve tricked a lot of people)


Other situations

Use development tools to see if wx.config is successful

success callback faild callback alert these callbacks

. . . Of course, I feel that your problem is caused by different domains. . . . .

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template