Program received signal : "EXC_BAD_ACCESS". + mi_cmd_stack_list_frames: Not enough frames in stack

Can someone help me out with this? I don't face any problems in Unity Remote. This happens when I export over to iPhone and only the button works but the rest doesnt.

The situation is as goes:

1) Player clicks on a button 2) The button then attaches a script to the camera 3) The script is trying to declare values to the variables.

This is probably where I think the error is coming from.

This is my code.

class Line extends MonoBehaviour
{
    public var currentCamera : Camera;

    var distance = 20;
    var drawArray : ArrayList = new ArrayList();
    var lineMat : Material;

    function Line()
    {
    }

    function Start()
    {
        var lineRenderer : LineRenderer = gameObject.AddComponent(LineRenderer);
        currentCamera = Camera.main;
        lineMat = Resources.Load("Trail", typeof(Material));
        lineRenderer.material = lineMat;
    }

    function Update()
    {
        ProcessInput();

        var lineRenderer : LineRenderer = GetComponent(LineRenderer);
        lineRenderer.SetVertexCount(drawArray.Count);

        for (var i : int = 0; i < drawArray.Count; i++)
        {
            lineRenderer.material = lineMat;
            lineRenderer.SetWidth(2,2);
            lineRenderer.SetPosition(i, drawArray*);*
 *}*
 *}*
 *function ProcessInput()*
 *{*
 *for(var p : int = 0; p < Input.touchCount; p++)*
 *{*
 *var touchPoint : Vector3 = Input.GetTouch(p).position;*
 *var screenPoint : Vector3 = new Vector3(touchPoint.x, touchPoint.y, distance);*
 *var worldPoint : Vector3 = currentCamera.ScreenToWorldPoint(screenPoint);*
 *if(Input.touchCount == 1)*
 *{*
 *if(Input.GetTouch(p).phase == TouchPhase.Began)*
 *{*
 *if(drawArray.Count == 0)*
 *{*
 *drawArray.Add(worldPoint);*
 *}*
 *else*
 *{*
 *}*
 *}*
 *if(Input.GetTouch(p).phase == TouchPhase.Moved)*
 *{*
 *drawArray.Add(worldPoint);*
 *}*
 *if(Input.GetTouch(p).phase == TouchPhase.Ended)*
 *{*
 *drawArray.Clear();*
 *}*
 *}*
 *}*
 *}*
*}*
*```*
*<p>EDIT: I figured out this is what is causing the problem. But is there any other way to assign a material by script?</p>*
*```*
*lineMat = Resources.Load("Trail", typeof(Material));*
*```*

In my case I got the same dreaded "Not enough frames in stack" message also for a material issue. I solved it by changing the material's shader (some default transparent), which was apparently not supported. I used additive particles instead.