微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

iOS:当WKWebView获取运动传感器时,将显示一个白色正方形

如何解决iOS:当WKWebView获取运动传感器时,将显示一个白色正方形

我正在制作一个使用360degee图像的VR应用程序。 此应用程序显示带有HTML的图像。 WKWebView可以获取设备的方向。

webView.uiDelegate = self

可以显示全向图像。

尽管如此,它还是在显示内容之前显示一个白色方框。 并点击该方块,将出现电影控制器。 然后单击“ X”关闭按钮,该方形擦拭消失,内容将开始。

White square on black screen

下面是我在模拟器上启动此应用程序时的错误消息。

2020-10-05 14:03:00.220288+0900 WebViewButton[70653:4552750] [assertion] Error acquiring assertion: <Error Domain=RBSAssertionErrorDomain Code=3 "required client entitlement is missing" UserInfo={RBSAssertionAttribute=<RBSDomainAttribute| domain:"com.apple.webkit" name:"mediaplayback" sourceEnvironment:"(null)">,NSLocalizedFailureReason=required client entitlement is missing}>
2020-10-05 14:03:00.220599+0900 WebViewButton[70653:4552750] [ProcessSuspension] 0x106df57e0 - ProcessAssertion: Failed to acquire RBS mediaplayback assertion 'WebKit Media Playback' for process with PID 70655,error: Error Domain=RBSAssertionErrorDomain Code=3 "required client entitlement is missing" UserInfo={RBSAssertionAttribute=<RBSDomainAttribute| domain:"com.apple.webkit" name:"mediaplayback" sourceEnvironment:"(null)">,NSLocalizedFailureReason=required client entitlement is missing}
2020-10-05 14:03:00.222371+0900 WebViewButton[70653:4552750] [assertion] Error acquiring assertion: <Error Domain=RBSAssertionErrorDomain Code=3 "required client entitlement is missing" UserInfo={RBSAssertionAttribute=<RBSDomainAttribute| domain:"com.apple.webkit" name:"mediaplayback" sourceEnvironment:"(null)">,NSLocalizedFailureReason=required client entitlement is missing}>
2020-10-05 14:03:00.225196+0900 WebViewButton[70653:4552750] [ProcessSuspension] 0x106df5810 - ProcessAssertion: Failed to acquire RBS mediaplayback assertion 'WebKit Media Playback' for process with PID 70653,NSLocalizedFailureReason=required client entitlement is missing}
2020-10-05 14:03:03.652871+0900 WebViewButton[70653:4552750] <CATransformlayer: 0x600003b09fe0> - changing property masksToBounds in transform-only layer,will have no effect
2020-10-05 14:03:03.653989+0900 WebViewButton[70653:4552750] <CATransformlayer: 0x600003b17200> - changing property masksToBounds in transform-only layer,will have no effect
2020-10-05 14:03:03.658501+0900 WebViewButton[70653:4552750] <CATransformlayer: 0x600003b0a520> - changing property masksToBounds in transform-only layer,will have no effect
2020-10-05 14:03:03.663858+0900 WebViewButton[70653:4552750] [plugin] AddInstanceForFactory: No factory registered for id <CFUUID 0x600003b0a7e0> F8BB1C28-BAE8-11D6-9C31-00039315CD46
2020-10-05 14:03:03.704443+0900 WebViewButton[70653:4552750] <CATransformlayer: 0x600003b07a40> - changing property masksToBounds in transform-only layer,will have no effect
2020-10-05 14:03:03.706753+0900 WebViewButton[70653:4552750] <CATransformlayer: 0x600003b0b340> - changing property masksToBounds in transform-only layer,will have no effect
2020-10-05 14:03:03.727357+0900 WebViewButton[70653:4552750] <CATransformlayer: 0x600003b0a520> - changing property allowsGroupBlending in transform-only layer,will have no effect
2020-10-05 14:03:03.727779+0900 WebViewButton[70653:4552750] <CATransformlayer: 0x600003b07a40> - changing property allowsGroupBlending in transform-only layer,will have no effect

据说没有mediaplayback资源。

什么?不需要Madiaplayer。

如何删除此白色方块? 如何禁用mediaplayback

下面是源代码

import UIKit
import WebKit

class WebViewController: UIViewController,WKNavigationDelegate,WKUIDelegate {
    @IBOutlet weak var webView: WKWebView!
    @IBOutlet weak var backBtn: UIButton!
    
    var rcvURL="" //Contents URL
    override func viewDidLoad() {
        super.viewDidLoad()
        webView.uiDelegate = self // enable to get omni direction sensor
        webView.navigationDelegate = self
        openUrl(urlString: rcvURL)
    }
    
    /** BackButton **/
    @IBAction func back(_ sender: Any) {
        self.dismiss(animated: true,completion: nil)
    }
    /** Open Contents URL **/
    func openUrl(urlString: String) {
       let url = URL(string: urlString)
       let request = NSURLRequest(url: url!)
       webView.load(request as URLRequest)
   }
}
  • 此环境是: Xcode12.0.1 iOS 14.0.1(iPhoneXR) Swift 5.3

解决方法

enter image description here

WebView检查器,请在内联播放中检查 true

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐


Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其他元素将获得点击?
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。)
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbcDriver发生异常。为什么?
这是用Java进行XML解析的最佳库。
Java的PriorityQueue的内置迭代器不会以任何特定顺序遍历数据结构。为什么?
如何在Java中聆听按键时移动图像。
Java“Program to an interface”。这是什么意思?