Sure, but that's because the compass in your phone is smaller than your nail is thick. Which obviously makes is significantly more sensitive to any disruption.
You can design a separate compass transmitting data to the smartphone. There's many people who could trade $50 and some additional weight in their bags for accuracy.