Do you know how it works? I mean, how can the camera even see the stars? Usually, the lense must be open for quite a while to take a picture of the night sky, no?
iPhone knows your latitude and longitude --- your position on the surface of the Earth. It also knows the location of each star. Lastly, it knows which way your screen is pointing.
That's all the knowledge that's needed in order to display a starfield on the screen.