I've heard the same thing a long time ago.
I never actually took the time to check if that's even remotely true.
- - -
After some reading...
No link has been proven between cravings and nutrient deficiencies.
It's probably more up to psychological factors like stress and addiction.
Sugar, carbohydrates and fat (cue: snacks and chocolate contain all three) create sort of an addiction, since they modulate the serotonin (happiness hormone) levels in brain.
Looking at food is also a part of that. Looking at food increases the levels leptin (the hunger hormone).
In the end, it's more about your brain messing with you.