I'm updating a jailbreak tweak of mine (GIFPaper) and am having a weird problem. My tweak lets the user put an animated GIF as their background image. Because of how much extra battery this takes up, I'm adding in a feature where the gif is only animating if the user is currently viewing it. For example, if the user enters into and app or shuts off the screen, then the GIF will pause. I'm trying to do this by key-value observing the "hidden" property of the SpringBoard background view (SBFWallpaperView). The weird problem is that in the observeValueForKeyPath: method I get updated a ton of times when the user does anything. For example, say the user is in an app and the gif is in a paused state. Then the user exits the app and the SBFWallpaperView's hidden property changes from true to false. Instead of observeValueForKeyPath: getting called once, it get called a ton of times. In this method, I log the hidden property of the observing object which is an instance of SBFWallpaperView. When the user exits an app, you would expect this to get called with log "FALSE" since the user can now see the background. Instead, something like this gets logged: TRUE FALSE TRUE FALSE TRUE FALSE
Why is the "hidden" property changing so much in such a short time and is there any way I could make it log "FALSE" once instead of it fluctuating so much?
Thanks!