简体   繁体   English

Tone.js 不会为 iOs 上的 Cordova 加载

[英]Tone.js doesn't load for Cordova on iOs

I'm trying to load Tone.js library to use inside my Cordova app with iOs as a target platform.我正在尝试加载 Tone.js 库以在我的 Cordova 应用程序中使用 iOs 作为目标平台。 When I start the iPhone emulator I see this error in the console:当我启动 iPhone 模拟器时,我在控制台中看到了这个错误:

[shim] BKSProcessAssertion "ConnectionTerminationWatchdog" initialized with invalid pid

The app doesn't load and I just see blank white screen.该应用程序未加载,我只看到空白屏幕。

I was trying to load the library from CDN, like this:我试图从 CDN 加载库,如下所示:

<script src="https://cdnjs.cloudflare.com/ajax/libs/tone/13.4.9/Tone.min.js" ></script>

And also from the local file system:并且还来自本地文件系统:

<script src="js/libs/tone/13.4.9/Tone.min.js"></script>

Doesn't seem to make any difference.似乎没有任何区别。 When I'm trying to debug the app from Safari, I see that the web page didn't even load.当我尝试从 Safari 调试应用程序时,我看到 web 页面甚至没有加载。 It seems that loading the library somehow makes the app hang forever until it crashes.似乎加载库以某种方式使应用程序永远挂起,直到它崩溃。

I tried to load the app without the library and then to try to load it from the console with javascript like this:我尝试在没有库的情况下加载应用程序,然后尝试使用 javascript 从控制台加载它,如下所示:

$.getScript( "js/libs/tone/13.4.9/Tone.min.js", function( data, textStatus, jqxhr ) {
  console.log( data ); // Data returned
  console.log( textStatus ); // Success
  console.log( jqxhr.status ); // 200
  console.log( "Load was performed." );
});

After I run this command Safari just dies like there is an infinite loop inside Tone.js or the loader.在我运行此命令后,Safari 就像 Tone.js 或加载程序内部存在无限循环一样死掉了。 I was trying different versions of Tone.js lib - didn't see any difference.我正在尝试不同版本的 Tone.js lib - 没有发现任何区别。

This is the environment that I use:这是我使用的环境:

Cordova Packages:
    cli: 10.0.0
        common: 4.0.2
        create: 3.0.0
        lib: 10.0.0
            common: 4.0.2
            fetch: 3.0.0
            serve: 4.0.0

Project Installed Platforms:
    android: 9.0.0
    ios: 6.1.1

Project Installed Plugins:
    cordova-plugin-whitelist: 1.3.4

Environment:
    OS: macOS 11.1 (20C69) (darwin 20.2.0) x64
    Node: v14.5.0
    npm: 6.14.6

ios Environment:
    xcodebuild:
    Xcode 11.7
    Build version 11E801a

I inspected iPhone simulator logs.我检查了 iPhone 模拟器日志。

It turned out, that WKWebView object was crashing while parsing the Tone.js library because some protobuf related library was missing on the iPhone simulator.事实证明,WKWebView object 在解析 Tone.js 库时崩溃,因为 iPhone 模拟器上缺少一些与 protobuf 相关的库。

The simulator was bundled with my version of XCode (11.7).该模拟器与我的 XCode (11.7) 版本捆绑在一起。 I upgraded XCode to version 12.3 and the problem disappeared.我将 XCode 升级到 12.3 版本,问题就消失了。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM