Re: My app only shows a black screen in the recent apps list
Re: My app only shows a black screen in the recent apps list
- Subject: Re: My app only shows a black screen in the recent apps list
- From: Alex Zavatone <email@hidden>
- Date: Thu, 22 Dec 2016 16:49:39 -0600
In that case, would it make sense when the app will enter background, to take a snapshot of the main window, then put that image layer over your main window so that you can guarantee that the image you desire is what the OS will take a snapshot of?
I like this approach because it is very easy to QA. You can output the image to a known file and you can see exactly what image should be captured by the OS.
Then when the app will enter foreground, set the hidden of that layer to YES and void the contents.
Even if you don't use this approach, it may be helpful in seeing why the OS is taking a lovely black image instead of the one you desire. You could even create a new window that holds this image and which is only displayed when the app is about to enter the background and is dismissed when i comes back.
Andreas, I am suspecting that the custom CGImage code might be causing this by getting in the way of what the OS expects. What format does the OS require before taking the screenshot? Maybe making sure that the OS can access your custom view's image content in the format it expects is what would fix this. (I'm expecting you're on iOS), can you make a UIimage from your window's top level view that is a viewController and put it in a UIImageView using imageWithCGImage? If you can, is it black? The CGImage is the underlying Quartz image data, not an image to itself. Also, what about the context, is it in the middle of drawing? Is there a way to access the CGImageRef of what you're drawing?
CGImageRef cgImage = CGBitmapContextCreateImage(context);
Apologies if I'm rambling. I'm tragically low on coffee.
Cheers,
- Alex Zavatone
On Dec 22, 2016, at 2:58 PM, 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.
>
>> On Dec 22, 2016, at 4:05 AM, Andreas Falkenhahn <email@hidden> wrote:
>>
>> When opening the recent apps list by pressing the home button twice
>> my app only shows a black screen instead of an image of the app's
>> look the last time it was closed. How can I fix this?
>>
>> My app's view hierarchy is Window => ViewController.View => ContentView.
>> The graphics are drawn by a platform-independent renderer into a
>> pixel buffer which is then converted into CGImage which is then
>> set as the content view's layer for every new frame like this:
>>
>> contentView.layer.contents = (id) myImage;
>>
>> This works fine but in the recent apps list my app is always just
>> shown as a black screen which is rather ugly. How can I fix this
>> please?
>>
>> --
>> Best regards,
>> Andreas Falkenhahn mailto:email@hidden
>>
>> _______________________________________________
>>
>> Cocoa-dev mailing list (email@hidden)
>>
>> 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:
>>
>> This email sent to email@hidden
>
> --
> David Duncan
>
>
> _______________________________________________
>
> Cocoa-dev mailing list (email@hidden)
>
> 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:
>
> This email sent to email@hidden
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden