Sunrise 1.1 Coming Soon

Update 1/16/14: Sunrise 1.1 is now available. Go grab it!

Thanks to Crashlytics I have learned that Sunrise 1.0 crashes - a lot. Fortunately, it would be very surprising if any of my customers have noticed, as the crash occurs when the app is in the background. The only sign the app has crashed is the next time it is launched it shows the launch animation instead of going straight to the main screen, which could happen anyway if iOS has decided to shut it down.

The crash itself was pretty easy to diagnose. Something was causing the Earth sunlight view to redraw, even though the app was not active. This view uses the fantastic GPUImage library to draw itself. GPUImage, in turn, uses OpenGL ES. On iOS, if an app is in the background and calls any OpenGL ES function, it will be forced into a crash.

The question then was, why is the sunlight view being redrawn? I had never reproduced the issue locally, so I had to work just from the crash log and my knowledge of how the app works. Fortunately, it didn’t take too much digging to discover the source of the problem, along with why I hadn’t ever reproduced it. Basically, the app requests the user’s current location and asks iOS to keep it informed of major location changes. If the location changes while the app was in the background (a common occurrence, it turns out), the sunlight view tries to update and the app crashes. This is a pretty obvious issue and one I shouldn’t have shipped with, but my crack QA team (read: me) missed it. Since the app really does not need to update while it is running in the background, the fix was to turn off location updates when it leaves the foreground. This has the added benefit of not causing extra drain on the device’s battery if it is the only app that has requested location changes.

Sunrise 1.1 also cleans up the sunlight view’s rendering shader, mostly for my own benefit (though it is a tiny performance win as well). I also added an indicator to the sunlight view to show the selected location. There are one or two minor bug fixes in there as well.

Sunrise 1.0 is now available in the App Store, and 1.1 will be available soon. Please check it out!