Further examinations have shown that the issue might be related to the
fact that my app has the "UIApplicationExitsOnSuspend" flag set to YES.
When removing this flag, it seems to work correctly. When activating it
again, however, iOS shows the image from the last run of the app with
"UIApplicationExitsOnSuspend" set to NO. Really does smell like an iOS
bug.

On 23.12.2016 at 14:35 Andreas Falkenhahn wrote:

> On 22.12.2016 at 21:58 David Duncan wrote:

>> Do you do anything special when going into the background? The
>> snapshot is taken shortly after your application is placed in the
>> background, so if your view hierarchy changes that is what will actually be 
>> snapshotted.

> No, I'm actually not doing anything when the app is shutdown. All
> respective delegate methods are completely empty. I should add
> that the actual drawing is done by a worker thread, but of course
> this thread calls dispatch_sync() when exchanging the layer's
> contents to the new image, e.g.

>      dispatch_sync(dispatch_get_main_queue(), ^{
>          myView.layer.contents = (id) myImage;
>      });

> So it could probably happen that this code is executed even after
> iOS runs methods like applicationWillResignActive() but certainly
> not at the same time because I use dispatch_sync() to change the
> layer's contents on the main thread.

> Upon closer observation, the behaviour is actually really strange.
> Now that I've added launch images (not a storyboard) the black screen
> is gone but the launch image is shown instead. But not always!
> Sometimes there's also a snapshot of my app. And what makes the
> confusion complete is the fact that iOS sometimes even alternates (!)
> between those two images when cycling through the recent apps list,
> e.g. when cycling through the recent apps list by swiping to the left
> my app shows the launch image. Then, without leaving the recent
> apps list, I'm cycling through the list again, but this time by swiping
> to the right, and suddenly my app shows the correct snapshot from
> the last frame it drew! This is really confusing. Smells like an
> iOS bug to me because why would it alternate between the launch image
> and a snapshot without me ever leaving the recent apps list? 



-- 
Best regards,
 Andreas Falkenhahn                            mailto:andr...@falkenhahn.com

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to