Xcode error: calling -display has no effect

2019-02-05 22:13发布

Whenever I load my SpriteKit app, it logs this error: <CAMetalLayer: 0x15f57fa70>: calling -display has no effect., and it doesn't properly display many objects. I have tried recreating the scene and removing my code, both of which have done nothing. For a while I thought this might have been a bug with the new Xcode 7 and iOS 9 beta, but now that I have tried it with the GM version of both and the problem persists, that probably isn't the case.

2条回答
神经病院院长
2楼-- · 2019-02-05 22:50

Check the zPosition of all your SKNodes. As it turns out, something changed in SpriteKit's implementation, and SKNode objects are no longer always rendered in the order they were added to their parent nodes. After I made sure all my SKNodes had the correct zPosition, everything went back to normal.

If that doesn't help, check this post from the dev forums.

查看更多
Rolldiameter
3楼-- · 2019-02-05 23:00

As someone suggested in this Apple Developer thread, adding the following key/value pair to your app's Info.plist seems to solve this issue for now.

Info.plist containing PrefersOpenGL key/value. Xcode 7.0.1

Make sure you choose Editor > Show Raw Keys & Values before entering the key name above.

As "MacMacMac" says in the forum post, this isn't an ideal fix, since using Metal is presumably better than using OpenGL, but at least OpenGL works.

查看更多
登录 后发表回答