1

I want to record my voice and set it as a sound in local notification payload. Please let me know if there is anyone facing the same issue?

Dheeraj Gupta
  • 372
  • 5
  • 20
  • Could this help ? https://stackoverflow.com/questions/40215838/unnotification-custom-sound-for-localnotification-is-not-playing-in-ios10 – Quentin Hayot May 18 '18 at 12:41
  • In the question you shared, the sound.mp3 is present in project bundle itself but in my case its not present in application bundle. I need to somehow copy it and make it useful because I am storing the recording in the dataDirectory not in the application bundle. – Dheeraj Gupta May 18 '18 at 12:45
  • Then it's a duplicate of this (and the answer is "Not possible"): https://stackoverflow.com/questions/31150806/uilocalnotification-playing-a-custom-audio-file-saved-in-documents-directory – Quentin Hayot May 18 '18 at 12:47
  • It is possible, I am working on it. If I manage to copy the file or being able to save the recording in the Library/Sounds. – Dheeraj Gupta May 18 '18 at 12:53
  • This seems to be true. I've retracted my close vote. https://developer.apple.com/library/content/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/SchedulingandHandlingLocalNotifications.html – Quentin Hayot May 18 '18 at 12:56

1 Answers1

4

To play a recorded voice as notification sound you have to store the recorded voice data in Library/Sound/Filename

Please check attached screenshot of apple documments.

enter image description here