Post

Replies

Boosts

Views

Activity

How to Make Xcode Recognize Morph Targets in a DAE File Imported from Blender? I'm working on a project in Xcode where I need to use a 3D model with multiple morph targets (shape keys in Blender) for animations. The model, specifically the Wolf3D_He
I'm working on a project in Xcode where I need to use a 3D model with multiple morph targets (shape keys in Blender) for animations. The model, specifically the Wolf3D_Head node, contains dozens of morph targets which are crucial for my project. Here's what I've done so far: I verified the morph targets in Blender (I can see all the morph targets correctly when opening both the original .glb file and the converted .dae file in Blender). Given that Xcode does not support .glb file format directly, I converted the model to .dae format, aiming to use it in my Xcode project. After importing the .dae file into Xcode, I noticed that Xcode does not show any morph targets for the Wolf3D_Head node or any other node in the model. I've already attempted using tools like ColladaMorphAdjuster and another version by JakeHoldom to adjust the .dae file, hoping Xcode would recognize the morph targets, but it didn't resolve the issue. My question is: How can I make Xcode recognize and display the morph targets present in the .dae file exported from Blender? Is there a specific process or tool that I need to use to ensure Xcode properly imports all the morph target information from a .dae file? Tools tried: https://github.com/JonAllee/ColladaMorphAdjuster, https://github.com/JakeHoldom/ColladaMorphAdjuster Thanks in advance!
1
1
832
Mar ’24
Firebase Realtime Database Error "Operation Canceled" Causes Observers to Stop Receiving Updates in Xcode 15.3
I'm developing an iOS application using Xcode 15.3 and Firebase SDK 11.3.0. My app utilizes Firebase Realtime Database to monitor changes in foodEntries through Firebase observers. Here's a simplified overview of my implementation: Setting Up Observers: I set up Firebase observers to listen for changes in the foodEntries node. This allows my app to react in real-time to any additions or modifications. Monitoring Connection Status: I check the Firebase connection status whenever the app becomes active. Additionally, I track the network connection using NWPathMonitor to handle connectivity changes. Issue: When I send the app to the background and then bring it back to the foreground, I occasionally encounter the following error in the console. This happens approximately once in ten attempts: 2024-10-10 17:49:08.588502+0200 MyApp[22614:2112636] [[FirebaseDatabase]] 11.3.0 - [FirebaseDatabase][I-RDB083016] Error sending web socket data: Error Domain=NSPOSIXErrorDomain Code=89 "Operation canceled" UserInfo={NSDescription=Operation canceled}. Consequences: Once this error occurs, my app stops receiving updates from the Firebase observers. The observers' closure callbacks are no longer triggered, effectively halting real-time data synchronization. Additionally, the Firebase connection status change is not triggered when this happens. Temporary Workaround: Interestingly, the issue resolves itself when I send the app to the background and then bring it back to the foreground. This action seems to reset the Firebase connection, allowing observers to function correctly again until the error reoccurs. What I've Tried: Reinitializing Observers: Attempted to remove and re-add observers upon detecting connection issues. Connection Monitoring: Implemented NWPathMonitor to track network changes and attempt reconnections. Error Handling: Tried catching errors during data operations to trigger retries or reconnections. Despite these efforts, the Operation canceled error persists and disrupts the observer functionality. Sample Code: Here's how I set up the Firebase observers and monitor the network connection: `import FirebaseDatabase import Network import Combine class UserData: ObservableObject { private let monitor = NWPathMonitor() private let networkQueue = DispatchQueue(label: "NetworkMonitor") private var cancellables = Set() @Published var isAppFirebaseConnected: Bool = false @Published var isAppNetworkConnected: Bool = false init() { setupFirebaseMonitoring() startNetworkMonitoring() } private func setupFirebaseMonitoring() { let db = Database.database().reference() let connectedRef = db.child(".info/connected") connectedRef.observe(.value) { [weak self] snapshot in if let connected = snapshot.value as? Bool { DispatchQueue.main.async { self?.isAppFirebaseConnected = connected if connected { print("Firebase is connected.") // Initialize observers here self?.initObservers() } else { print("Firebase is disconnected.") self?.removeObservers() } } } } } private func startNetworkMonitoring() { monitor.pathUpdateHandler = { [weak self] path in let isConnected = path.status == .satisfied DispatchQueue.main.async { self?.isAppNetworkConnected = isConnected print("Network connection status: \(isConnected ? "Connected" : "Disconnected")") if isConnected && self?.isAppFirebaseConnected == false { // Attempt to reconnect Firebase if needed self?.reconnectFirebase() } } } monitor.start(queue: networkQueue) } private func initObservers() { let db = Database.database().reference() db.child("foodEntries").observe(.childAdded) { snapshot in // Handle new food entry print("New food entry added: \(snapshot.key)") } db.child("foodEntries").observe(.childChanged) { snapshot in // Handle updated food entry print("Food entry updated: \(snapshot.key)") } } private func removeObservers() { let db = Database.database().reference() db.child("foodEntries").removeAllObservers() print("Removed all Firebase observers.") } private func reconnectFirebase() { print("Attempting to reconnect Firebase...") Database.database().goOffline() DispatchQueue.main.asyncAfter(deadline: .now() + 1.0) { Database.database().goOnline() } } }` Problem Description: Observers Stop Working: After some time, the Operation canceled error appears, and the Firebase observers stop receiving updates. No Triggered Closures: The closure callbacks for .childAdded and .childChanged are no longer invoked. Manual Reset Required: Backgrounding and foregrounding the app temporarily fixes the issue by resetting the Firebase connection. Question: How can I prevent the NSPOSIXErrorDomain Code=89 "Operation canceled" error from disrupting Firebase Realtime Database observers in my SwiftUI app using Xcode 15.3 and Firebase SDK 11.3.0? Additionally, how can I effectively track and handle network connectivity changes to ensure that Firebase observers remain functional without requiring manual app state resets? What I Need Help With: Understanding the Cause: Insights into why the Operation canceled error occurs and how it affects Firebase's WebSocket connections. Robust Error Handling: Best practices for handling such network-related errors to maintain continuous observer functionality. Network Monitoring Integration: Examples or suggestions on effectively integrating network monitoring to trigger Firebase reconnections when necessary. Alternative Solutions: Any alternative approaches or configurations that can mitigate this issue. Additional Information: Firebase Configuration: I'm using default Firebase configurations and have enabled offline persistence. Device Environment: The issue occurs on both simulators and physical devices with stable internet connections. App Lifecycle Management: Observers are set up when the app becomes active and removed when it resigns active, as shown in the sample code. Any guidance or examples on handling this Firebase connection error and maintaining observer reliability would be greatly appreciated!
1
0
208
Oct ’24