Anas (RAA) narrated, 'The first time cupping was dis-liked for the one who is fasting was when Ja'far bin Abi Talib had himself cupped while fasting and the Messenger of Allah (ﷺ) came across him and said, "Those two have broken their fast (meaning Ja'far and the man who was cupping him.)" But later on the Prophet allowed cupping for the one who is fasting. Anas used to have himself cupped while he was fasting. Related by Ad-Daraqutni, who regarded it as a strong hadith.
English reference: Book 5, Hadith 688
Arabic reference: Book 5, Hadith 667