2 Replies
      Latest reply on Nov 18, 2019 6:04 PM by Nick_C_Nine
      espeng123 Level 1 Level 1 (0 points)

        I am loading a website with a WKWebView in my Xcode app and the website requires device motion to function. In safari, the website requests access to device motion (ios 13 feature), but in Xcode, it does not request access nor does it begin to track motion data. Using the WebView app on the app store I am able to load in the same website in a WKWebView and the motion is track meaning it is definitely possible. Any help I can get on this feature would be greatly appreciated. Thanks in advance!

         

        Here is some more info:

         

        ios 13 Device Motion Request JS Code:

        DeviceMotionEvent.requestPermission()

              .then(response => {

                if (response == "granted") {

                  window.addEventListener("devicemotion", e => {

                    console.log(e.acceleration)

                  });

                }

              })

              .catch(console.error);

         

        Here is a website to demo device motion that works on the WebView app, but not in a basic WKWebView:

        https://www.audero.it/demo/device-orientation-api-demo.html