To be able or not to be able to give fruits to the dogs is a dilemma. Dogs are carnivorous animals, which feed mainly on proteins of animal origin - a good example of this are wild dogs that, running freely through a forest, do not stop to eat apples, but look for an animal to hunt.
Not that it is forbidden to offer fruits to the dogs, but it is necessary to be careful. Some dogs may feel tender in the stomach when eating more acidic fruits, which can cause vomiting due to gastritis and, in some cases, diarrhea.
Fruits that are not acidic are not usually harmful to most dogs, but they should also not be offered in large quantities or frequency, as they can lead to obesity. A good example is the comparison with the chocolate cake for us - it has benefits, but it is also fattening. You can learn more about the relationship between dogs and fruits here.
Hope this helps,