简体   繁体   中英

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. When I start the iPhone emulator I see this error in the console:

[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:

<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. 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:

$.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. I was trying different versions of Tone.js lib - didn't see any difference.

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.

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.

The simulator was bundled with my version of XCode (11.7). I upgraded XCode to version 12.3 and the problem disappeared.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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