Mac OS X 10.10: Can't create image of anything to do with SpriteKit

Originator:brandon
Number:rdar://17865930 Date Originated:30-Jul-2014 08:28 PM
Status:Resolved Resolved:10.11
Product:OS X SDK Product Version:Mac OS X 10.10 (14A298i)
Classification:Enhancement Reproducible:Always
 
Summary:
It’s possible to create textures from a node graph (-[SKView textureFromNode:]) but it’s not possible to turn that into an image. It also seems possible to draw the contents of a SKView on iOS through the use of -[UIView drawViewHierarchyInRect:afterScreenUpdates:] but I can’t find a way to replicate this behaviour on OS X without using the Quartz window API, and that’s really not the same and far from ideal. There’s -[SCNView snapshot] (which only works if the view is on-screen, but SCNView also exposes the OpenGL context), but no similar method for SKViews. It shouldn’t be required to use SCNView’s overlaySKScene property to take advantage of this behaviour. Finally, the SK documentation, when talking of `textureFromNode:`[1], mentions this as a use case: “you might want to take a screenshot of your gameplay to show to the player after he or she completes the level.” It’s currently not possible to do anything outside of SK with that screenshot like, say, upload to CloudKit for a global leaderboard or save to the users camera roll. This seems like a common use case that is missing completely from SK.

[1]: https://developer.apple.com/library/ios/documentation/GraphicsAnimation/Conceptual/SpriteKit_PG/Sprites/Sprites.html#//apple_ref/doc/uid/TP40013043-CH9-SW13

Steps to Reproduce:
1. Install Xcode
2. Create an OS X Sprite Kit project
3. Decide you want users to be able to do something with a screenshot of an SK view/node/texture
4. Hit a wall

Expected Results:
I would expect it to be trivial for a developer to create an image of either/all of an SKView, SKNode or SKTexture

Actual Results:
It is impossible to do so without resorting to insufficient techniques like using the Quartz window API

Comments


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!