Open mcconkiee opened 5 years ago
ok.... Here's how i fixed this:
speech_recognition
pubspec.yml
in flutter appSwiftSpeechRecognitionPlugin.swift
file, change line 111 (see old commented line)
let audioSession = AVAudioSession.sharedInstance()
try audioSession.setCategory(AVAudioSession.Category.record, mode: .default)
try audioSession.setMode(AVAudioSession.Mode.measurement)
// try audioSession.setActive(true, with: .notifyOthersOnDeactivation)
try audioSession.setActive(true, options: .notifyOthersOnDeactivation)
i'd PR this, but don't have the time right now. Just making a note here.
I'm having a similar issue... @mcconkiee 's fix didn't work for me.
`Launching lib/main.dart on iPhone 7 in debug mode... Xcode build done. 1.3s Failed to build iOS app Error output from Xcode build: ↳ BUILD FAILED Xcode's output: ↳ === BUILD TARGET speech_recognition OF PROJECT Pods WITH CONFIGURATION Debug === /Users/Downloads/speechrecognition-master/ios/Classes/SwiftSpeechRecognitionPlugin.swift:186:76: error: 'Category' is not a member type of 'AVAudioSession' fileprivate func convertFromAVAudioSessionCategory( input: AVAudioSession.Category) -> String {
try audioSession.setCategory(AVAudioSession.Category.record, mode: .default)
^~~~~~~~~~~~~~ ~~~~~~~~
AVFoundation.AVAudioSession:23:14: note: did you mean 'category'?
open var category: String { get }
^
/Users/Downloads/speech_recognition-master/ios/Classes/SwiftSpeechRecognitionPlugin.swift:112:30: error: type 'AVAudioSession' has no member 'Mode'
try audioSession.setMode(AVAudioSession.Mode.measurement)
^~~~~~~~~~~~~~ ~~~~
AVFoundation.AVAudioSession:33:14: note: did you mean 'mode'?
open var mode: String { get }
^
ObjectiveC.NSObject:160:15: note: did you mean 'zone'?
open func zone() -> NSZone!
^
ObjectiveC.NSObject:162:21: note: did you mean 'zone'?
open class func zone() -> NSZone!
^
/Users/Downloads/speech_recognition-master/ios/Classes/SwiftSpeechRecognitionPlugin.swift:114:48: error: extra argument 'options' in call
try audioSession.setActive(true, options: .notifyOthersOnDeactivation)
~^~~~~~~~~~~~~~~~~~~~~~~~~~
Could not build the application for the simulator.
Error launching application on iPhone 7.
Exited (sigterm)
`
Just to follow up... my errors above were because I wasn't using Swift 4.2 (which requires XCode 10). The syntax used in this package is specific to Swift 4.2.... compiling with 4.1 won't work. Also, the Podfile requires:
config.build_settings['SWIFT_VERSION'] = '4.2'
just below the 'ENABLE_BITCODE' line, and also:
use_frameworks!
just below
target 'Runner' do
This was all very painful to figure out for myself... perhaps the readme should make it clear?
sorry I did not realized that 4.2 was available for XCode10 only. I updated the README.
I was able to make it running by changing my podfile as that:
post_install do |installer|
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings['SWIFT_VERSION'] = '4.2'
config.build_settings['ENABLE_BITCODE'] = 'NO'
end
end
end
sorry I did not realized that 4.2 was available for XCode10 only. I updated the README.
I still dont see the config on the README man. Still struggle on this one, fix follow @ROTGP & @shinayser but no luck. When I ran debug, this is showing:
Installing speech_recognition (0.3.0)
- Running pre install hooks [!] Unable to determine Swift version for the following pods:
speech_recognition
does not specify a Swift version and none of the targets (Runner
) integrating it have theSWIFT_VERSION
attribute set. Please contact the author or set theSWIFT_VERSION
attribute in at least one of the targets that integrate this pod.
I'm unable to run an iOS build. The following errors happen to me running against iOS 12. This is a simulator (perhaps a reason?), have not tried on a device. Please let me know if you need more info.
XCode 10.1 Project is swift (Language version 4)