Unable to display 2D images in Scene Kit with iOS 12

As part of my scene kit app I display UIImage objects by using a SCNPlane. This works fine with iOS11 and watchOS 4, but the images are not visible with iOS 12 and watchOS 5. This is the case for images that are assets, and also for images created on the fly within the app.


The code I am using is this:


SCNMaterial* material = [SCNMaterial material];

material.diffuse.contents = image;

SCNPlane* plane = [SCNPlane planeWithWidth:image.size.width height:image.size.height];

plane.materials = @[material];

SCNNode* node = [SCNNode nodeWithGeometry:plane];


Am I doing something wrong that I could get away with prior to iOS 12, or is there a bug in iOS 12?


I have tried adding a billboard constraint but that just caused the screen to go completely white when the node was displayed. What might I be doing wrong with that? Does the constraint affect the scale of the node perhaps?


Thanks.

Replies

Just in case anyone else has the same problem, I got round it by making the material double-sided.


I am glad it was a relatively obvious fix as it was a pain to test because the problem did not occur when built with XCode 10. The only way to test was to release a beta built with XCode 9 and install it on a device with watchOS 5 installed. For future reference does anyone know if it is possible to use a release version of XCode with a simulator running a beta of watchOS?