Tracing the name of a picked object

The problem I now face is that I cant print out the name of the object my ray is colliding with. I get the error ‘Object reference not set to an instance of the object’ which isnt really english to me. I have attached the code …

   for(touch in iPhoneInput.touches){ 
            
        var touch : iPhoneTouch = iPhoneInput.GetTouch(0); //0 represents a one finger touch       
		var ray : Ray =Camera.main.ScreenPointToRay(Vector3((touch.position.x),(touch.position.y),100));
		var hit : RaycastHit;//this structure can return information about objects hit with the ray
		
		
		Debug.DrawRay (ray.origin, ray.direction *20, Color.blue);

     	//upon touching cast a ray to see what has been hit
		     	if(touch.phase == iPhoneTouchPhase.Began||touch.phase == iPhoneTouchPhase.Moved)
		     	
		     	{
				
		 		  	if (Physics.Raycast(ray))
		 		  	 {
		 		  	 	
		  
		     	   	Debug.Log("Something in front of the ray"+hit.collider.transform.name);
		   				}
		       		 else
		        	{
		        	Debug.Log ("NOTHING SELECTED");
		  			  }
		     	}
}
for(touch in iPhoneInput.touches){ 
            
        var touch : iPhoneTouch = iPhoneInput.GetTouch(0); //0 represents a one finger touch

The start of you FOR loop and your first property/variable definition are using the same names(touch)?