Code works in standalone but not iphone

var texture1 : Texture2D;

and

rend = gameObject.GetComponent(Renderer);
rend.material.mainTexture = texture1;

When I comment out those 2 lines it compiles fine however I use it to change the texture of an object when it is collected. How would I do it on ios? Am I not doing it the best way?

you have to type your variables in iOS strictly.

var rend : Renderer = gameObject.GetComponent(Renderer);