It is narrated from Abu Qatadah Ansari (may Allah be pleased with him) that he was with the Prophet ﷺ on the way to Makkah. He, along with some of his companions who were in the state of Ihram, stayed behind, while he himself (Abu Qatadah, may Allah be pleased with him) was not in Ihram. He saw a wild donkey and mounted his horse. Then he said to his companions (who were in Ihram), "Hand me the whip," but they refused. Then he asked for his spear, but they also refused to give it. Finally, he took his own spear, attacked the donkey, and killed it. Some of the companions of the Prophet ﷺ ate its meat, while others refused (because of being in Ihram). When they reached the Messenger of Allah ﷺ, they asked him about this issue. He ﷺ said: "This was a meal which Allah provided for you."
Hadith Referenceمسند الإمام الشافعي / كتاب الحج / 907
Hadith Takhrijأخرجه البخاري، الجهاد والسير، باب ما قيل في الرماح (2914) ومسلم، الحج، باب تحريم الصيد مأكول البري..... الخ (1196)۔