Post

Replies

Boosts

Views

Activity

Reply to SCNTechnique & Metal handleBindingOfSymbol()
Is setObject(_:forKeyedSubscript:) safe to call every frame? The documentation appears to suggest otherwise: Use this method when you need to set a value infrequently or only once. To update a shader value every time SceneKit renders a frame, use the handleBinding(ofSymbol:using:) method instead. I am using ARKit + Scenekit and I am trying to pass in the smoothedSceneDepth from the LiDAR Scanner into a custom SCNTechnqiue. I convert the CVPixelBuffer into a MTLTexture, then pass that into my technique like so: let mtlTex = PixelBufferToMTLTexture(pixelBuffer: pixelBuffer) arscnView.technique?.setObject(SCNMaterialProperty(contents: mtlTex), forKeyedSubscript: "camera_depth" as NSCopying) This appears to work correctly, however I have had the occasional crash when calling setObject every frame.
Topic: Graphics & Games SubTopic: SceneKit Tags:
Mar ’21
Reply to iOS 15 beta wipes out app data
I managed to solve this issue. In my scenario it was caused by a race condition in reading the Keychain too early in the app launch. I was checking for an auth token on the keychain within SceneDelegate.scene(_:willConnectTo:options:). Instead I wait for the keychain protected data to become available like so:     func refreshAuthFromKeychain(_ callback: @escaping (Bool) -> Void) {         /// Avoid race condition where the app might try to access keychain data before the device has decrypted it         guard UIApplication.shared.isProtectedDataAvailable else {             NotificationCenter .default .publisher(for: UIApplication.protectedDataDidBecomeAvailableNotification) .first() .sink { _ in                 self.refreshAuthFromKeychain(callback)             }.store(in: &cancellables)             return         } .... /// Then load from the keychain
Topic: Privacy & Security SubTopic: General Tags:
Sep ’21