SKView warning logs - swift

When running my SwiftUI & SpriteKit app, I get the following messages in the logs:
2019-11-18 21:58:57.631912+0000 PixelBattles[2812:1215803]
SKView: ignoreRenderSyncInLayoutSubviews is NO. Call _renderSynchronouslyForTime without handler
What am I doing wrong to receive this log, and should I worry about it? Could it be a bug?
Could it be that SwiftUI cannot figure out how to do the layout for an SKView?
Major edit:
If you need code, you can see it in the previous edits. Below I state why I don't think it is any longer relevant.
I have sent Apple some feedback (FB7456217). I have removed the code, as I no longer suspect it is an issue to do with my code. I created a blank game project, no SwiftUI, and still got the same warning log instantly.
So even with the default project template, the log still appeared for device and simulator. I will update on this issue if I get a useful response.
I still haven't heard anything back - has anyone got any new information since when I posted this over half a month ago? I still have these warnings!

This is Apple's response to this issue:
Hi! You don't really need to fix that. That's a log message that was
left by mistake in SpriteKit framework. It was removed and will no
longer appear in the future SpriteKit versions. Thanks!

just figured this out for myself.
In your code change
if let scene = SKScene(fileNamed: "GameScene")
to
if let scene = GameScene(fileNamed: "GameScene")

I believe you'll also get this warning if you have UIKit subviews of the SKView.

Related

Execution of the command buffer was aborted due to an error during execution. Insufficient Permission (to submit GPU work from background)

I have a SpriteKit project in which I'm suddenly seeing the following error repeatedly printed to the logs when testing on a real device:
Execution of the command buffer was aborted due to an error during execution. Insufficient Permission (to submit GPU work from background)
This happens when the app is in the background state.
Now, it's pretty obvious what's going on: SpriteKit uses Metal, and the latter is committing new work to the GPU when the app is backgrounded (which is something you can't do).
I've confirmed this theory by not loading my SpriteKit scenes. If I don't load the scenes, the problem does not occur.
What I've tried:
In my SceneDelegate's sceneWillResignActive(_:) function, I tried setting isPaused to true, like this:
func sceneWillResignActive(_ scene: UIScene) {
GameSceneHelper.scene.isPaused = true
CloudSceneHelper.scene.isPaused = true
}
...and then resuming the scenes in sceneDidBecomeActive(_:), like this:
func sceneDidBecomeActive(_ scene: UIScene) {
GameSceneHelper.scene.isPaused = false
CloudSceneHelper.scene.isPaused = false
}
I'd think that would work, but it doesn't. The error persists.
Question:
What's going on, here? Why am I suddenly getting this new error, and how do I solve the problem?
Thank you!
Edit:
I found a (ugly) workaround: Because my SpriteKit scenes are presented using SwiftUI, I can just set a boolean that indicates whether or not to show the scenes. There's no error when I do it this way.
Unfortunately, this results in undesirable behaviors: 1) when you swipe the app away, you can see the scene suddenly disappear, 2) when you bring the app to the foreground you can see the scene suddenly reappear, and 3) the app snapshot (that iOS takes of your app when you move it to the background) shows an empty screen because the scenes have already been hidden when it takes the snapshot.
I can't understand why this is happening in the first place; my understanding was that SpriteKit scenes are automatically paused when the app is in the background.
So, I'm still looking for a better solution -- and maybe an explanation.
Edit #2:
According to Apple's documentation, SpriteKit is, indeed, paused/resumed automatically when the app goes from/to the background:
When an application moves from an active to an inactive state, isPaused is automatically set to true. When an application returns to an active state, isPaused is automatically set to its previous value.
I heard back from Apple Support after sending them an Xcode project illustrating the problem. They recommended that I file a bug report using Feedback Assistant. So, it appears that this is a legitimate bug.
Apple says the problem is related to the use of the playSoundFileNamed, which is somehow making my update(_:) function get called while the app is in the background (and while the SpriteKit scene is paused!).
What's really weird to me is that I don't see other people reporting this problem. If all it takes to trigger this is the use of playSoundFileNamed, I would expect a lot of SpriteKit developers to have the same issue. Maybe SpriteKit isn't used that much? I don't know.

My Scene turns blank and gray when I turn on Post Porcessing from the dropdown

My Post processing worked when i started my project but now that i am several months into it, my scene view turns blank and gray when i check the post processing from the dropdown. I am using Unity 2019.4 Any ideas? My first posting was deleted because of clarity without notifying me, so I have been stuck on project for days waiting for an answer that was never going to come. I don't know how much more I can say. I you don't understand my post then don't just delete it, let me know what you don't understand.
It looks like i may have fixed it. I got an error message saying that it couldn't add another camera, so i looked at the FPS. I didn't see anything wrong so I just removed it and reinstalled the FPS controller. That seems to have fixed it. Thanks for the responses.

Trouble with SKAudioNode

In my app when the screen is touched I want to play my file "pewpew.mp3". It is not working. I've looked at several of these posts but none of the are working. This is my code:
let shootNoise = SKAudioNode(fileNamed: "pewpew.mp3")
shootNoise.autoplayLooped = false
addChild(shootNoise)
shootNoise.run(SKAction.play())
hero.run(playNoise)
That is all inside of the
override func(touchesEnded)
Any ideas? I feel like I'm over-thinking this.
I'm late to answering this - but the code should/does work... so a couple of quick checks - is the file name and extension correct? Is the code block being run (ie, are touches ended being detected correctly). Are there other things in the scene that have changed the way sounds would be played? if you run this code in your app in a blank scene - does it work? (would have written a comment but am not allowed).

GLPaint Version 1.12 shake gesture doesn't work

In the newly released GLPaint sample code from Apple seems to be an error: the shake event doesn't work. But i can't find the reason, even after looking up nearly every thread about shake events in this forum.
i am really going crazy because i don't see anything wrong in the code.
EDIT:
I thought i would have come closer (but it still doesn't work) by changing following things:
In AppController.h change UIWindow to "PaintingWindow". Also the .xib file, i changed the class to PaintingWindow. Another thing is, i overwrote the function canBecomeFirstResponder in PaintingWindow.m with return YES. Furthermore i added in applicationDidFinishLaunching, that the window becomes first responder.
So changed a lot, nothing worked. Please someone?

tap back immediately after moving the map crashes application in iPhone

I came across the scenario where in if after moving the map immediately if I tap on back icon while the map has not fully loaded
The application crashes.
What I can understand is Since the loading is still in progress and I tap back the the application releases the controller but the google map loads asynchronously in NSRUNloop (not sure). So that might be the problem not sure though.
So does anybody know what can be the issue and is there any way to solve this issue?
Please comment if more description required.
It sounds like that when you close the view, the object that is the delegate for the completed map load has been deallocated, causing the crash with a bad access.
A good way to get to the bottom of these types of crashes is to use Instruments (part of the Xcode suite to tools) and go zombie hunting.
For anyone who is still searching for the answer
What exactly happening was that map view events were getting fired even if the controller was released causing a crash in the app.
So the solution is Before setting the value of objMKMapView to nil you need to set value of objMKMapView.delegate to nil.