Apple designed their devices in such way that there is way for them to circumvent their security. The fact that apple must comply is their own fault.
It is obvious that the security scheme of iOS is weak - it is security trough obscurity. They tried to make secure encryption with only 18 bits of user input. If the user provided all of the 128/256 bits the case would have been moot.
So what is the moral - when you design security solution - make sure that you can give the FEDS complete control over all of your data and company resources and they still would not be able to harm your consumer. How? Make sure the user and only the user can set the keys.