Whether or not there is an agreement between Apple and Ireland or just an understanding that Ireland would not tax them on almost any income is irrelevant. The point of the matter is that the effect of the scheme has been that Apple has paid next to nothing in tax on all European profits in more than a decade, spanning from the sale of your first iPod to your newest iPhone. That income has been channeled through the Irish companies and Ireland has not taxed it with it's usual corporate tax (which, by the way is now merely 12.5 percent). It is appalling.
That's the crux of the overall matter, from a political point of view. Ireland benefits from the European market disproportionately more than the EU benefits from Ireland. This is why Ireland ends up being "a scapegoat" - because nobody is particularly happy about their status as the onshore tax-haven of choice for healthy US multinationals, so every time they end in a pickle, they have very few friends (and with Brexit, they effectively lost their biggest one).
The EU has decided that all revenue income for that company should be charged in Ireland, although the US say they have also paid tax in the US.
Fundamentally Ireland is saying it did not give a "deal", the EU is saying it calculated the tax incorrectly and the US is saying that the EU's findings are based on no tax being paid elsewhere which was not the case.
As was also pointed oout, Ireland seems to be the scape-goat for all EU decisions. The Irish bail out has already been mentioned in this thread, but for those who are unaware of what happened here is a simple break down.
German companies bought binds in banks (like shares). When the banks started to fail, Germany told Ireland that the tax payer had to pay the bond holders all the investment money and the interest. However if the tax payer had purchased these bonds, they would have never received anything back. They also told Ireland that if they tried to burn the bond holders they would incur trade embargo's to stop Ireland trading in the common market (Ireland makes a loot of money from exports to Europe). So basically it was pay the bond holders or you will have no income.