No, there's no reason you would have to cook fresh corn, though you would need to shuck it & remove all the silk so there's no chance of a bird possibly getting an impacted crop.....
As to how long it could hang in a cage, would probably depend on where you lived and how fast a cob would take for mold to develop.....in a hot dry climate, you might have a day or two, but in a hot moist climate, mold would probably develop in 24 hours, though, depending on how many & what size birds were eating from an ear of corn, there might not be any corn left on a cob, but mold could still develop on a moist, empty cop.....