Post

Replies

Boosts

Views

Activity

Reply to Black Screen with the text "Move iPad to start"
I fixed this by running startSession outside the body. That was causing the issue. @MainActor func startSession() { guard #available(iOS 17.0, *) else { return } do { let session = ObjectCaptureSession() var configuration = ObjectCaptureSession.Configuration() configuration.checkpointDirectory = getDocumentsDir().appendingPathComponent("Snapshots/") try session.start(imagesDirectory: getDocumentsDir().appendingPathComponent("Images/"), configuration: configuration) self.session = session } catch { sessionError = error } } Also added: .onAppear { startSession() } after .environment(\.colorScheme, .dark) Here is the final part of the code inside the ZStack if let session = session { ObjectCaptureView(session: session) if case .ready = session.state { Button(action: { session.startDetecting() }) { Text("Continue") .foregroundColor(.white) .padding() .background(Color.blue) .cornerRadius(10) } } else if case .detecting = session.state { Button(action: { session.startCapturing() }) { Text("Start Capture") .foregroundColor(.white) .padding() .background(Color.blue) .cornerRadius(10) } } } else if let error = sessionError { Text("Failed to start ObjectCaptureSession: \(error.localizedDescription)") } else { Text("Initializing...") } As you can see I changed the CreateButton part because it was also not defined in the video. So I went back to the old way of creating buttons. Hope this helps you move fwd
Jun ’23