I don't know but, this game stores everything about your game data from your characters to currency on the servers - hence why whenever you delete it and redownload it, you get everything back without having to restore your game save.
Since they store all of this on their server, the game loads the amount of crystals on your idevice when you open it, and sure you can modify the number and it will say whatever it is you put but, since the number of what it says on the server, and the number it says on your idevice are different, the game realises this which is why it restarts.
Say I use GameGem to edit how much i have, and i have 500 crystals currently and I change it to 30000 crystals, once i spend 500 crystals on my game i'd see 29500 but my actual amount of crystals would be, 0 so if I tried to spend my gems on buying more energy, you get the error message saying something went wrong or whatever it is and it restarts.
You probably had enough to buy it before you edited it but you didn't realise it. If it had worked, you could of closed the app and restarted it with your modified amount of crystals, but from what you said in your comment previously, that didn't seem to be the case (but it would be awesome if it would work).
It's the same thing for every other game EA has made for the past couple years.