我在我的应用程序中使用 Google Mobile Vision。我遇到无法识别的选择器 lldb 崩溃。我已将问题范围缩小到这行代码......
var faceDetector = GMVDetector.init(ofType: GMVDetectorTypeFace, options: options)
Run Code Online (Sandbox Code Playgroud)
这是变量options
:
let options = [GMVDetectorFaceLandmarkType: GMVDetectorFaceLandmark.all, GMVDetectorFaceClassificationType: GMVDetectorFaceClassification.all, GMVDetectorFaceTrackingEnabled: false] as [String : Any]
Run Code Online (Sandbox Code Playgroud)
有什么问题吗options
?我查看了其他 SO 帖子,发现大多数问题都源于字典。
我该如何解决这个问题?
我正在使用 AVAudioEngine 播放和录制音频。对于我的用例,我需要在开始录制音频时准确地播放声音。目前,我的录音似乎在播放声音之前就开始了。如何让声音和录音同时开始?理想情况下,我希望录音开始和声音同时播放,而不是在后期处理中同步它们。
这是我目前的代码:
class Recorder {
enum RecordingState {
case recording, paused, stopped
}
private var engine: AVAudioEngine!
private var mixerNode: AVAudioMixerNode!
private var state: RecordingState = .stopped
private var audioPlayer = AVAudioPlayerNode()
init() {
setupSession()
setupEngine()
}
fileprivate func setupSession() {
let session = AVAudioSession.sharedInstance()
try? session.setCategory(.playAndRecord, options: [.mixWithOthers, .defaultToSpeaker])
try? session.setActive(true, options: .notifyOthersOnDeactivation)
}
fileprivate func setupEngine() {
engine = AVAudioEngine()
mixerNode = AVAudioMixerNode()
// Set volume to 0 to avoid audio feedback while recording.
mixerNode.volume = …
Run Code Online (Sandbox Code Playgroud)