I am transferring an audio file from Apple Watch extension to iOS
application.

In the Extension:
func sendAudioFileProper(){
    WCSession.default().transferFile(saveURL as! URL, metadata: nil)
}

I create saveURL like this:

let fileManager = FileManager.default
let container =
fileManager.containerURL(forSecurityApplicationGroupIdentifier:
"group.net.ericd.WatchRecord")
let fileName = "audioFile.wav"
saveURL = container?.appendingPathComponent(fileName) as NSURL?

iOS application:

func session(_ session: WCSession, didReceive file: WCSessionFile)
{
    DispatchQueue.main.async
    {
        self.versionLabel.text = "We got a real audio file."
        self.versionLabel.textColor = UIColor.blue
       * // ? How do I use the file to instantiate an AVAudioPlayer?*

Now, I want to instantiate an AVAudioPlayer and play that sent file. I know
that it's received (didFinish file transfer fires in the Watch Extension).
How do I do that? I don't know how to make that file Data.

I am using an app group if that matters. Should I be saving the file when
received, then use it to create the AVAudioPlayer? If so, how should I do
that?
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to