Adding Polyline entity with clampToGround:true crashes on cesium(v1.55) with cordova on iOS

1. A concise explanation of the problem you're experiencing.
While trying to add a polyline entity with clampToGround set to true, I get a rendering error, and Cesium stops rendering. This is happening on simple iOS Cordova build on an iphoneX.
The rendering error does not happen unless clampToGround is set to true.

Looking through the Cesium code, I traced it to the Primitive.prototype.update function. While updating a groundprimitive in a PrimitiveCollection.

The error thrown in tryAndCatchError is (Full Reponse in attached txt):
statusCode: 0
response: "{\"6-0-0\":[10.662392616271973,26.89437484741211],\"6-0-1\":[6.744882106781006,20.60187530517578],\"6-0-2\":[4.049985408782959,14.190625190734863]…"
responseHeaders: {}

here is the relevant code:
function updateAndRenderPrimitives(scene) {
        var frameState = scene._frameState;
   
         //----EXCEPTION THROWN FROM INSIDE HERE-----
        scene._groundPrimitives.update(frameState);
...

Primitive.prototype.update = function(frameState) {
        if (((!defined(this.geometryInstances)) && (this._va.length === 0)) ||
            (defined(this.geometryInstances) && isArray(this.geometryInstances) && this.geometryInstances.length === 0) ||
            (!defined(this.appearance)) ||
            (frameState.mode !== SceneMode.SCENE3D && frameState.scene3DOnly) ||
            (!frameState.passes.render && !frameState.passes.pick)) {
            return;
        }

                 //----EXCEPTION THROWN HERE-----
        if (defined(this._error)) {
             throw this._error;
         }
        
                if (defined(this.rtcCenter) && !frameState.scene3DOnly) {
            throw new DeveloperError('RTC rendering is only available for 3D only scenes.');
        }
        
        if (this._state === PrimitiveState.FAILED) {
            return;
        }

2. A minimal code example. If you've found a bug, this helps us reproduce and repair it.
(from https://cesiumjs.org/Cesium/Apps/Sandcastle/index.html?src=Polyline.html)
var viewer = new Cesium.Viewer('cesiumContainer');

var redLine = viewer.entities.add({
    name : 'Red line on terrain',
    polyline : {
        positions : Cesium.Cartesian3.fromDegreesArray([-75, 35,
                                                        -125, 35]),
        width : 5,
        material : Cesium.Color.RED,
        clampToGround : true
    }
});

3. Context. Why do you need to do this? We might know a better way to accomplish your goal.
I am attempting to evaluate Cesium for my company. I am trying to dynamically draw paths on the ground by touching points on the screen. This works without clampToGround set but not with it set. Even the most simple example of adding a polyline entity with clampToGround set results in a crash (rendering stopped undefined [object object])

4. The Cesium version you're using, your operating system and browser.
Cesium v1.55. iOS12. Mobile Safari. Cordova build 8.1.2

Reponse.txt (538 KB)

I don't have an iPhone X on hand for testing, or access to an environment that for building Cordova apps for iOS, but I'm unable to reproduce this in Sandcastle on either a 1st or 3rd generation iPad Pro. Are you able to reproduce this directly in Safari or does this only happen via Cordova?

Please also be advised that the WebGL implementations on many newer mobile devices (including most iOS devices newer than the iPad 4) do not implement certain WebGL extensions at sufficient precision, which may cause artifacts in typical use. See these two issues for more information:

https://github.com/AnalyticalGraphicsInc/cesium/issues/6735
https://github.com/AnalyticalGraphicsInc/cesium/issues/6739

Thanks for the reply! I do not see it in sandbox on mobile safari on the same phone, so I’m guessing it has something to do with Cordova? I am using the webkit plugin for it as well (which uses the newer iOS webkit interface instead of the older UIKit which cordova defaults to).
I just don’t have any insight as to why it would specifically only crash when clampToGround is set to true. Maybe some interaction with webkit?

What is the suggested way of developing using cesium cross-platform? Is react-native a better alternative to Cordova?

Thanks!

Doug

I’ve seen people use Electron with Cesium for desktop apps. I don’t have any personal experience with Cesium on Cordova vs react native, but I’d be very curious to know if this bug doesn’t occur with react-native.