MeshDataTool causing error in iOS

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By monkeyTester
:warning: Old Version Published before Godot 3 was released.

Hello,
I am trying to modify the vertex colours of a mesh at run time. I am using the MeshDataTool to access the mesh details so that i can change the values. On the desktop it worked fine, however on iOS ( built it on ipad mini 2) it throws an error. The code i am trying to execute is

	var meshData=MeshDataTool.new()
    meshData.create_from_surface(meshNode.get_mesh(),0)
    for vertexIndex in range(meshData.get_vertex_count()):
	meshData.set_vertex_color(vertexIndex,Color(0.5,0,0.5))
    var mesh=Mesh.new()
    meshData.commit_to_surface(mesh)
    meshNode.set_mesh(mesh)

the error log for iOS build
e[1;31mERROR: create_from_surface: e[0me[1mCondition ’ arrays.empty() ’ is true. returned: ERR_INVALID_PARAMETER
e[0;31m At: scene/resources/mesh_data_tool.cpp:52.e[0m
e[1;31mERROR: mesh_add_surface: e[0me[1mCondition ’ array_len==0 ’ is true.
e[0;31m At: drivers/gles2/rasterizer_gles2.cpp:1877.e[0m
e[1;31mERROR: add_surface: e[0me[1mCondition ’ len==0 ’ is true.
e[0;31m At: scene/resources/mesh.cpp:262.e[0m

Is it not possible to use the MeshDataTool on iOS. it runs without any problems on desktop? Is there something else im missing here? meshNode does have a mesh assigned to it. I ran a print(meshNode.get_mesh().get_surface_count()) and it returned 1.
i printed out the surface_get_array_len and it gives the proper value which is 36 in my case.