2

I read Similar questions like this question I have an app that should access to recorded sound (with voice Memos or other Recording apps) - I don't want to record sound in my app - I just want to access the recorded sound - I know that there are some limits in Ios for doing this But I think It is possible please help me

Remember That I read Similar questions But My question is different because I don't want to record sounds in my app

Martijn Pieters
  • 1,048,767
  • 296
  • 4,058
  • 3,343
Saeed Rahmatolahi
  • 1,317
  • 2
  • 27
  • 60

1 Answers1

2

Why don`t you try to use AVAudioPlayer of AVFoundationFramework?

You could also try some third-party framework like SwiftySound
https://github.com/adamcichy/SwiftySound

Just to mention: there is also a plenty of system sounds which is sometimes quite useful.

You can see the list at the following link
https://github.com/TUNER88/iOSSystemSoundsLibrary

You can play them by implementing AudioToolbox framework in your project. Add this into a file (if you are using Objective-c) #import <AudioToolbox/AudioToolbox.h>
Then run AudioServicesPlaySystemSound(PUT_SOUND_ID_HERE); somewhere.

Alexander
  • 2,803
  • 5
  • 13
  • 21
  • Thanks I Preferred to use File Sharing when user connected the device to computer and add sound file with iTunes – Saeed Rahmatolahi May 06 '17 at 12:11
  • You are welcome, is there anything else you would like to clarify about this topic? – Alexander May 06 '17 at 12:30
  • In File Sharing I have Two Problems : 1- when I copy a file into the app with iTunes when I close the iTunes and open the app again I can't see the file (Is it because I don't have database?) 2- I don't know what should I write that App detect that I added file or not – Saeed Rahmatolahi May 06 '17 at 12:37
  • 1. How do you store the file in your app? There is should be a few ways. Using one of the databases(Core data, Realm, SQLite) as well. But usually there is a recommendation not to store big binary data objects in databases. Not only the audio but f.e. pictures as well. So you can save the files to the **document directory** or other directories of your app then store url or path in database. Personally would try realm, but it is up to your choice. – Alexander May 06 '17 at 19:04
  • so you mean I should use data base right? Realm is very easy and nice but the problem is that it will add 60 MB to my app and I don't want to have bigger Size than Current size and Please help me and answer this question that related to our discussion http://stackoverflow.com/questions/43820961/how-to-display-files-from-files-sharing-in-swift-3 – Saeed Rahmatolahi May 07 '17 at 04:46
  • I will check that question. When in comes to storing images or something else databases is more appropriate when you expect to have large amount of records. Let's say 1k. There is also a few more approaches to store images on IOS device. The simplest way is to store image in `document directory` and save a path in `NSUserDefaults`. http://stackoverflow.com/questions/14531912/storing-images-locally-on-an-ios-device . F.e. you could also save image paths to the file and parse it. However there is also a disadvantages of that methods. How many images do you expect to have? – Alexander May 08 '17 at 17:15
  • I know that without data base I can storage Images and open them in the file sharing when I connect the Device to the iTunes ! But I want to have something like File Manager in my App that I can See the Images or Other Files that I Download or Copy to the App with File Sharing Can you Tell me Where can I see the examples ? – Saeed Rahmatolahi May 09 '17 at 06:22
  • Why don`t you use SQLite? It is not as powerful as realm but it does not take so much storage to run. – Alexander May 18 '17 at 18:38
  • I forget how to use it can you write a link that I can learn that again ? – Saeed Rahmatolahi May 18 '17 at 20:21
  • For example, check some of this tutorials: http://www.appcoda.com/sqlite-database-ios-app-tutorial/ https://www.raywenderlich.com/123579/sqlite-tutorial-swift https://www.raywenderlich.com/913/sqlite-tutorial-for-ios-making-our-app or https://www.google.ru/#newwindow=1&q=SQLite+tutorial+objective-c – Alexander May 18 '17 at 22:26