Works perfect on Android but not on IOS.
I followed the Example properly, and it works perfectly on android, but it just doesn't work on IOS. Please help. Thanks a ton. It doesn't work on the IOS speaker nor the Headphones.
@KarHack Are you testing on an emulator or real device? I have tested the example on an iphone XR 12.1 emulator and a real device (iphone XS max) running iOS 12.1.2 and it's working.
Similar issue here, clone the example and testing on real device iPhone 7 running iOS 12.1.2. Many languages shows duplicate item: https://i.imgur.com/B69Cfgx.png, select the duplicated one leads to an error: https://i.imgur.com/1ejQp7v.png.
Other selectable language dosen't play sound when hit the button, tested on plugin version 0.1.2 and 0.2.0.
Android works well include the voices options which just added in 0.2.0.
Thanks for your effort, any reply will be appreciated.
Edit: sorry it's copy .dart from example, not clone full project.
@KarHack @IvanBean can one of you test the latest 0.2.1 package I just published? Thank you
I just cleaned and checked 0.2.1 package, on Iphone 6s running iOS 12.1.2. It is still not working. Thanks for your quick reply and effort, really great project.
Hi @dlutton
Thanks for the quick reply, the duplicate language is fixed now.
About the voice, after some investigating I found one solution is to modify AppDelegare.swift under my flutter project's ios/Runner directory, full code:
import UIKit
import Flutter
import AVFoundation // Add this line.
@UIApplicationMain
@objc class AppDelegate: FlutterAppDelegate {
override func application(
_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?
) -> Bool {
// Add below.
do {
try AVAudioSession.sharedInstance().setCategory(AVAudioSessionCategoryPlayback)
do {
try AVAudioSession.sharedInstance().setActive(true)
} catch {
}
} catch {
}
// Add above.
GeneratedPluginRegistrant.register(with: self)
return super.application(application, didFinishLaunchingWithOptions: launchOptions)
}
In this way the voice can play successfully, however, I'm an Android developer and new to Flutter so I don't know whether this is a correct approach. Thanks.
Unfortunately i don't have a 6s phone to test it on @KarHack. I did test a 6s emulator and it's working. The voice is also working when I test on my physical device (iphone Xs). Are there any error logs you can provide from your device?
and sorry for the dumb question, but did you make sure to turn off your silent mode (the physical switch)?
I cloned the project, and its working on the Iphone 6s iOS 12.1.2. Yes, I did make sure that the phone was out of silent mode (physical switch), but yes now it's working once I cloned the project. Probably I missed something when copying from the example. Thanks a ton. I am not an iOS developer, so what should I do if I have to implement this into an existing application?
@dlutton I copy main.dart from example too, not clone full project, sorry for misleading in my first comment.
@KarHack maybe we meet the same problem that device can't play sounds without AVAudioSessionCategoryPlayback, you can try to edit AppDelegare.swift in my comment above as a temporary workaround if it works for you.
@KarHack Will do that, next time. Thank you. @dlutton Thanks a ton for the Library, I am Closing the Issue.
@dlutton sorry that I made a stupid mistake that tested on the silent mode you mentioned above, the library works in iOS. I've created a PR #24 to enable playback in silent mode, thanks.
@IvanBean thanks for the PR. I'll test it out and merge if everything works.
@IvanBean I have merged the PR. I'll have to refactor it once I upgrade the code to swift 4.2 since there appears to be issues. I'm hoping the ios/swift team can correct it without having to apply a bandaid.