The belief was that the hedgehog rolls on apples or grapes to make the fruit stick to its spines, so it can carry the food back to its young. The bestiary writers allegorized this as a warning of the clever stratagems of the devil in stealing man's spiritual fruits. Pliny the Elder 1C CE (Natural History, Book 8, 56): To prepare for winter, hedgehogs roll on fallen apples to stick them to their spines, then taking one or more in their mouths, carry the load to hollow trees. Hedgehogs foretell a change in wind direction from north to south when they retire to their lairs. When hunted, they roll up into a ball so that it is not possible to pick them up without touching their spines.
Isidore of Seville [7C CE] (Etymologies, Book 12, 3:7): The hedgehog is covered with quills, which it stiffens when threatened, and rolling itself into a ball is thus protected on all sides. After it cuts a bunch of grapes off a vine it rolls over them so it can carry the grapes to its young on its quills.