Closed ianyh closed 9 years ago
Something more complicated is going on here. I've been doing more diagnosing and I've got it working correctly with both Crashlytics enabled and disabled. I will try to narrow it down more and figure out what the actual problem is. In the mean time I will rename the issue.
Figured it out. The problem was the background color of the splash view controller. The default background color of a UIView
is nil
, which is transparent. Usually this doesn't actually matter as the controller is usually part of some presentation context, most notably a UINavigationController
which does not have a transparent background by default, or it is generated by a nib file or storyboard, both of which use white backgrounds for views by default.
So if you programmatically generate the splash view controller it will look as if it has a black background. I haven't actually tested this completely, but it seems like the presentation with no animation immediately displays the splash view controller's transparent view on top of the underlying black of the window. If the presentation were animated it would look like a delay in the view being presented and the view it's being presented on disappearing suddenly. But the snapshotting just puts a transparent view on top of the window.
The end result being that it looks like the snapshotting isn't working correctly. The transparent view doesn't actually block the underlying one, but when you open the app it actually refreshes the view to match the presentation so you see the black right before the authentication request happens or the passcode view pops up. It looks like a black splash with no snapshotting.
I thought that presentation didn't remove the presenting view controller's view anymore, so I'm actually not entirely sure why it shows up as black, but that is definitely the behavior I have observed. Regardless, it's worth noting in the docs that you need to set a background color or possibly just giving the splash view controller a default background color.
I'm not sure what was going on with Crashlytics. Possibly I somehow mucked with things so that the presentation was happening before iOS took the snapshot, but Crashlytics caused the race condition to work out the other way.
Hey @ianyh
Thanks for looking into that. Do you want to create a PR that sets the default color of VENTouchLockSplashViewController
in its init
.
Done!
I end up with a
Unbalanced calls to begin/end appearance transitions
error and locking from background doesn't actually work. Well, it works in that you can't open the app without unlocking, but it doesn't snapshot correctly.I haven't had time to investigate in detail. I'll probably also ask Crashlytics for any info they might have and can report back here.