I think this is the best way to tax corporations. Corporations can move around where they produce goods, but it's much harder to move where they sell them.
Seems simple enough, but money is changing hands throughout the production process. Apple and its suppliers' wages are taxed. What's left over is taxed when spent or invested for a return.
Given the leviathan tax systems out there, it's no wonder tax havens exist in the first place. Before judging this activity as unethical and shifting the tax avoidance to some other place though, governments really need to perform a cost-benefit analysis of their tax laws and make it clear to companies what's expected from them in return for access to their market.
Money can change hands where you want it to change hands, and profit can occur where you want it to occur. In this case, Apple Ireland buys an iPhone from the manufacturing division for (say) $300, sells an iPhone to Apple Italy for $800, and Apple Italy sells it to a consumer for $800. Apple Ireland made $500 profit, Apple Italy makes $0 profit, and so pays taxes in Ireland and not Italy.