Flash memory is used in most small devices, much more EMF-reistant.

The kind of magnetic field put out by a sewing/improvised compass needle is unlikely to effect it. Particularly when you figure the needle will most likely be against the battery, and that is probably throwing a stronger magnetic field around it.

What is more likely is that the field around the battery will screw up the polarity of your compass.

Your biggest danger is that the needle might shift, and short something. Unlikely, but at that point, your phone is probably pooched.