Post

Replies

Boosts

Views

Activity

visionOS Immersive Space is dismissed when app goes in the background
Hi, My app launches with a mixed immersive space. the Preferred Default Scene Session Role is set to Immersive Space Application Session Role. ImmersiveSpace(id: "sceneSpace"){ ImmersiveView() .environmentObject(modelObject) }.immersionStyle(selection: .constant(.mixed), in: .mixed) Other WindowGroups are opened too. Problem: When the x button (bottom left corner) is tapped on any WindowGroup the immersive space is dismissed. When the user opens the app again the immersive space is gone. The same happens when the user opens the Home Screen. How can I keep the same immersive space when the app is opened again. Thank you!
4
0
1.3k
Feb ’24
AppDataModel is retained
Hi, In the scanning objects using object capture project, when the content view is dismissed the AppDataModel is always retained and the deinit is never called. @StateObject var appModel: AppDataModel = AppDataModel.instance I am presenting the contentView using a UIHostingController let hostingController = UIHostingController(rootView: ContentView()) hostingController.modalPresentationStyle = .fullScreen present(hostingController, animated: true) I have tried to manually detach the listeners and setting the objectCaptureSession to nil. In the debug memory graph there is a coachingoverlay retaining the AppDataModel. I want to remove the appModel from memory when the contentView is dismissed. Any suggestions?
2
0
823
Jul ’23
How to remove a StateObject from memory
Hi everyone, I have a content view that declares a StateObject @StateObject var appModel: AppModel = AppModel.instance I present the content view from a uikit view: let swiftUIView = ContentView() let hostingController = UIHostingController(rootView: swiftUIView) hostingController.modalPresentationStyle = .fullScreen DispatchQueue.main.async{ self.present(hostingController, animated: true, completion: nil) } I dismiss the contentview this way: struct DismissingView: View { @Environment(\.dismiss) var dismiss var body: some View { Button(action: { dismiss() } , label: { VStack(spacing: 10) { Image(systemName: "xmark") .resizable() .aspectRatio(contentMode: .fit) .frame(width: 22) } .foregroundColor(.white) }) } } when I dismiss the content view I want to deallocate everything, but the stateobject remains. I have tried changing it to an observedObject with no success. Any idea how to deallocate everything? Thank you
1
0
591
Jul ’23
Audio in ARKit causes a crash when returning from background
I have an ARKit app that plays sounds using playaudio let audioPlay = SCNAction.playAudio(audioSource!, waitForCompletion: false) when the app moves to the background i get the following : AURemoteIO.cpp:1590:Start: AUIOClientStartIO failed (561015905) AVAEInternal.h:109  [AVAudioEngineGraph.mm:1544:Start: (err = PerformCommand(*ioNode, kAUStartIO, NULL, 0)): error 561015905 when it comes back to the foreground and a sound is played it crashes and i get the following: [avae]      AVAEInternal.h:76  required condition is false: [AVAudioPlayerNode.mm:712:ScheduleBuffer: (outputFormat.channelCount == buffer.format.channelCount)] in crash logs the crash is happening here : AVAudioFileImpl::CheckClientFormatSet() + 60 tried fixes: Enable background audio works but my app does not have any logical use for background audio self.sceneView.audioEngine.mainMixerNode.outputVolume = 0.0 when app moves to background. still crashes but less often Any help would be appreciated.
3
0
1.8k
Jul ’20
SCNAudioplayer pause
here is how i add an audio player to a SCNNodelet audioSource = SCNAudioSource(fileNamed: nodeName) audioSource?.volume = 1 audioSource?.loops = true audioSource?.load() audioSource?.isPositional = true let audioPlayer = SCNAudioPlayer(source: audioSource!) node.addAudioPlayer(audioPlayer)i try to pause the audioPlayer but it doesn'taudioPlayer.audioNode?.engine?.pause()I am trying to pause the audioPlayer because when Replaykit's alert appears (user permission) it pauses my AR scene but not my audioplayers so the sounds are out of sync with the SCNNode when the alert is dismissed. any idea on how i can pause a SCNAudioPlayer ?thanks
0
0
761
Feb ’20