Closed zouzijidelu closed 1 year ago
@zouzijidelu
Thanks for your report, and so sorry for our late reply.
We tried the code, and it works well.
However,
.setExposureProgram(program: .aperturePriority)?
just work for the camera model RICOH THETA Z1
.
If you used other than RICOH THETA Z1
, you will get error.
So, could you tell us which model did you use?
If you already used RICOH THETA Z1
,
could you send us the error log?
Thank you very much.
hi: when take picture get error: SWIFT TASK CONTINUATION MISUSE: takePicture(_:) leaked its continuation!
WHY????????? My Swift Demo: func takePicture( callback: @escaping ( url: String) -> Void) async throws { try await initialize() let photoCapture: PhotoCapture = try await withCheckedThrowingContinuation {continuation in thetaRepository!.getPhotoCaptureBuilder().setFilter(filter: ThetaRepository.FilterEnum.hdr).setExposureProgram(program: .aperturePriority)?.setIsoAutoHighLimit(iso: .iso800)?.setAperture(aperture: .aperture56)?.setWhiteBalance(whiteBalance: ThetaRepository.WhiteBalanceEnum.auto)?.setExposureDelay(delay: .delayOff)? .build {capture, error in if let photoCapture = capture { continuation.resume(returning: photoCapture) } if let thetaError = error { continuation.resume(throwing: thetaError) } } } class Callback: PhotoCaptureTakePictureCallback { let callback: ( url: String?, error: Error?) -> Void init( callback: @escaping ( url: String?, error: Error?) -> Void) { self.callback = callback } func onSuccess(fileUrl: String) { callback(fileUrl, nil) } func onError(exception: ThetaException) { callback(nil, exception as? Error) } } let photoUrl: String = try await withCheckedThrowingContinuation {continuation in photoCapture.takePicture( callback: Callback {fileUrl, error in if let photoUrl = fileUrl { continuation.resume(returning: photoUrl) } if let thetaError = error { continuation.resume(throwing: thetaError) } } ) } callback(photoUrl) }