Search code examples
avfoundationswift3xcode8watchconnectivitywatchos-3

Error while Recording Audio on watch-os-3


I wanted to record my Audio on Applewatch and send to my iPhone. I created a URL to store the file and everytime I try this on my simulator it is working fine but on real device nothing happes with this error

Error: Error Domain=com.apple.watchkit.errors Code=3 “(null)”

URL:

var dir = fileManager.containerURL(forSecurityApplicationGroupIdentifier: "group.com.companyname.projektname")

RECORD:

presentAudioRecorderController(withOutputURL: dir,preset:.narrowBandSpeech,
                                                            options: nil,
                                                            completion:.........

Solution

  • On WatchOS 3 you also need to add a "Privacy - Microphone Usage Description" entry in the info.plist file of your iOS app (not the WatchKit app). Then on the iPhone you must agree with using the microphone.

    I found this here: https://forums.developer.apple.com/thread/62612