Post

Replies

Boosts

Views

Activity

Reply to SceneKit app seriously hangs when run in fullscreen
I was able to recreate the issue with a small sample project that repeatedly calls SCNView.projectPoint(_:) in a block dispatched to the main actor inside the SCNSceneRendererDelegate.renderer(_:didApplyAnimationsAtTime) method. In my personal project, the issue happens when calling that method 6 times (in order to position 6 sprites in the overlay SpriteKit scene that should follow objects in the SceneKit scene), but in the sample I call it 200 times to reliably reproduce the issue. As mentioned previously, the hangs only happen when running the app in fullscreen, but I noticed that when moving the mouse to the top of the screen to show the menu bar, the game runs smoothly. As soon as the menu bar disappears again, or if I click a main menu item to show the submenu, the game immediately hangs again and shows maybe 2 or even less frames per second. Sometimes the hangs continue happening unless I show the menu bar again, but sometimes the game begins running smoothly again after a couple seconds. This is again confirmed by Instruments. Interestingly, if I comment out the line Task { @MainActor in and the corresponding closing curly bracket 4 lines down, there is no hang anymore, not in fullscreen, and not when clicking the main menu: Is this an issue with SCNView.projectPoint(_:)? Or with the delegate method? Or with doing SceneKit things on the main thread? I thought that we're supposed to add nodes and do modifications on the main thread, so how could I avoid thread races if in this delegate method the only solution is not to use the main thread? class GameViewController: NSViewController, SCNSceneRendererDelegate { var scnView: SCNView? override func viewDidLoad() { super.viewDidLoad() let scene = SCNScene(named: "art.scnassets/ship.scn")! let ship = scene.rootNode.childNode(withName: "ship", recursively: true)! ship.runAction(.customAction(duration: 999, action: { node, t in Task { @MainActor in node.eulerAngles.y = t } })) let scnView = self.view as! SCNView self.scnView = scnView scnView.scene = scene scnView.delegate = self } func renderer(_ renderer: any SCNSceneRenderer, didApplyAnimationsAtTime time: TimeInterval) { Task { @MainActor in for _ in 0..<200 { let _ = scnView?.projectPoint(SCNVector3(x: 0, y: 0, z: 0)) } } } }
Topic: Graphics & Games SubTopic: SceneKit Tags:
Nov ’24
Reply to macOS keeps showing "[App] would like to access data from other apps" warning even if accepting it each time
[quote='779363022, difosfor, /thread/742147?answerId=779363022#779363022, /profile/difosfor'] I've tried to open your feedback ticket to add this information there as well, but wasn't able to open that. [/quote] You won't be able to open other developers' feedbacks, only Apple can. 11 months ago my feedback was updated with Every time the pid changes will trigger new prompt for consent. This is as expected. (Everytime you re-build/run your project, your pid will change.) I asked if this is documented, but never got a response.
Topic: App & System Services SubTopic: General Tags:
Nov ’24
Reply to SKTexture used for SceneKit object is rendered too bright
Right now for SceneKit I'm preloading SCNMaterial by running material.diffuse.contents = url and for SpriteKit I run SKTexture(image: NSImage(contentsOf: url)!) in the background. If I need the same image for both SceneKit and SpriteKit, this means that it's read twice from disk. As mentioned, I'd like to use SKTexture because that's what I think could be preloaded once and then used in both SpriteKit and SceneKit.
Topic: Graphics & Games SubTopic: SceneKit Tags:
Nov ’24
Reply to Can SceneKit be used with Swift 6 Concurrency ?
I just converted my code to Swift 6 today. My SceneKit game kept crashing on launch. I figured out that simply calling this code ship.runAction(.customAction(duration: 1, action: { _, _ in })) causes a crash with Swift 6, while it works with Swift 5. Another sign that SceneKit is not ready for Swift 6. I filed FB15570385.
Topic: Graphics & Games SubTopic: SceneKit Tags:
Oct ’24
Reply to getattrlistbulk lists same files over and over on macOS 15 Sequoia
[quote='809127022, DTS Engineer, /thread/766035?answerId=809127022#809127022'] SO, my immediate question is why are you calling getattrlistbulk? [/quote] I think I switched to getattrlistbulk many years ago for performance reasons. Perhaps I didn't test correctly at the time, or perhaps FileManager became faster in the meantime... in any case, I cannot switch back just yet because of some missing or unsupported URLResourceKey values. fileIdentifierKey for instance is only available since macOS 13.3 and iOS 16.4, and it was only added because I opened a feedback about it (or it was coincidentally added at the same time). I think your attributeBuffer is FAR to small: (I would keep quoting you like above, but it seems that multiple quotes are not rendered correctly, so I have to resort to the Markdown quote syntax) Thanks for pointing that out. I increased it to 32 * 1024 as suggested... If your "ATTR_CMN_NAME" parsing fails in the right name, then you'll end up returning "parent path" as the new file full path. You'll then recurse on exactly the same directory. ... but still, even though your explanation makes sense, it cannot be the cause here. If any file name failed to parse in my original code and resulted in the parent directory being scanned again, the output would show start scan [...] which is not the case here. Instead, getattrlistbulk just continues by listing files we've already seen. I did take a look at your attachment, but I think something was completely broken in the upload process, garbling the file to the point where I couldn't really get it working. Here I try to upload the code again. ViewController.swift
Topic: App & System Services SubTopic: Core OS Tags:
Oct ’24
Reply to Modal UINavigationController shown programmatically has no navigation buttons
[quote='809291022, Frameworks Engineer, /thread/766374?answerId=809291022#809291022'] When you set the primary action, we take the title & image from that action for the bar button item [/quote] Thanks! I see now that the documentation for primaryAction says this as well. Though in other places in my project I use let button = UIBarButtonItem(title: "button", primaryAction: UIAction(handler: { action in ... })) which works fine and I assumed was the same as let button = UIBarButtonItem(title: "button") button.primaryAction = UIAction(handler: { action in ... })
Topic: UI Frameworks SubTopic: UIKit Tags:
Oct ’24
Reply to Xcode UI test cannot tap menu button in form
[quote='800821022, Developer Tools Engineer, /thread/760070?answerId=800821022#800821022'] You can see what type it is by printing app.debugDescription and searching for "menu2" [/quote] Sorry for my late reply, once again I wasn't notified of a new post even though I'm subscribed to this topic. Here's the output I get when running app.debugDescription. Both menu1 and menu2 seem to be buttons.
Oct ’24
Reply to Take correctly sized screenshots with ScreenCaptureKit
[quote='807305022, DTS Engineer, /thread/765360?answerId=807305022#807305022'] There's no supported way for you to calculate the window shadow's frame with the APIs currently available. If you'd like us to consider adding the necessary functionality, please file an enhancement request using Feedback Assistant. [/quote] Thanks, I filed FB15370384.
Topic: Media Technologies SubTopic: General Tags:
Oct ’24