Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error while running Pod install #4

Closed
iNima opened this issue Oct 21, 2019 · 5 comments
Closed

Error while running Pod install #4

iNima opened this issue Oct 21, 2019 · 5 comments
Assignees

Comments

@iNima
Copy link

iNima commented Oct 21, 2019

Hi there and thanks for sharing this plugin with the community.

I'd like to use this plugin in both iOS and Android but when I run pod install for the iOS I receive this error:

- `flutter_audio_recorder` does not specify a Swift version and none of the targets (`Runner`) integrating it has the `SWIFT_VERSION` attribute set. Please contact the author or set the `SWIFT_VERSION` attribute in at least one of the targets that integrate this pod.

I think you need to add the SWIFT_VERSION in your podspec file. For example, the current SWIFT_VERSION in my app is 4.2

Could you please check this and modify your code?

@nikli2009 nikli2009 self-assigned this Oct 21, 2019
@nikli2009
Copy link
Contributor

hi @iNima , thanks a lot !
I just added this config(swift_version = 4.0), please let me know if this works for you.
Latest version is 0.4.5

@iNima
Copy link
Author

iNima commented Oct 21, 2019

Hi @nikli2009 , thanks for your prompt update.

Yes, now the pod install is done correctly without any error but when I'm building the app it is not successful and shows these two errors:

/Users/iNima/.pub-cache/hosted/pub.dartlang.org/flutter_audio_recorder-0.4.5/ios/Classes/SwiftFlutterAudioRecorderPlugin.swift:69:108: error: 'AVAudioSessionCategoryOptions' has been renamed to 'AVAudioSession.CategoryOptions'
                    try AVAudioSession.sharedInstance().setCategory(AVAudioSessionCategoryPlayAndRecord, with: AVAudioSessionCategoryOptions.defaultToSpeaker)
                                                                                                               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                                                                                                               AVAudioSession.CategoryOptions

    AVFoundation.AVAudioSessionCategoryOptions:2:18: note: 'AVAudioSessionCategoryOptions' was obsoleted in Swift 4.2
    public typealias AVAudioSessionCategoryOptions = AVAudioSession.CategoryOptions
                     ^
    /Users/iNima/.pub-cache/hosted/pub.dartlang.org/flutter_audio_recorder-0.4.5/ios/Classes/SwiftFlutterAudioRecorderPlugin.swift:153:68: error: cannot call value of non-function type 'AVAudioSession.RecordPermission'
                switch AVAudioSession.sharedInstance().recordPermission(){
                       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~

The first one is related to the Swift version. The latest Swift version of my app is 4.2 by the way but I don't know why that error happened. Maybe using the deprecated AVAudioSessionCategoryOptions is not supported in 4.2 anymore and it is not backward compatible!

@nikli2009
Copy link
Contributor

Thanks for all the details information :) @iNima my apology for the late response.
I added some swift version specific code to help Xcode to compile for swift 4.2 below and 4.2 above. Hope this can resolve this issue. ;)
Latest version is 0.4.7

Just in case it doesn't work, pls try

  1. Xcode -> Product -> Clean Build Folder.
  2. Clear /ios/Pods folder, Delete /ios/Podfile.lock, Clear /ios/.symlinks/ folder
  3. Run flutter pub get
  4. cd /ios, run pod install
  5. in Xcode, try Product -> Run

@iNima
Copy link
Author

iNima commented Oct 22, 2019

Great! Thanks @nikli2009
It works correctly now.
There is only one minor issue which is the version of the plugin in the flutter_audio_recorder.podspec which is still 0.4.5 instead of 0.4.7.
https://github.com/shadow-app/flutter_audio_recorder/blob/8b3b58e55ce61e8de7ae5a8eb8e93653a9f06e26/ios/flutter_audio_recorder.podspec#L6
It is not an impediment by the way. The only drawback of it is showing an incorrect version in Podfile.lock and Manifest.lock.

@nikli2009
Copy link
Contributor

Haha my mistake, just updated it in 0.4.8. @iNima
Going to close this issue as It's working for you now. ;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants