How to export downloaded audio file(from within app folder) to user accessible music folder in IOS - ios

I am using Xamarin to develop an IOS app. Here the user has an option to download audio files to the document folder within the app, and play it later on.
But i would like to provide an option for the user to access it in music folder or somewhere else, so that user does not have to come back to app to listen it.
Like we save images to camera roll, can we save mp3 or any other audio file to default music folder in IOS. Any solution or ideas using xamarin or xcode are welcome.
Note: I already know about File Sharing with itunes, i am looking for something else explained above.

As I know this isn't possible due to the limitations within iOS

Related

How detect changes in the application documents directory in iOS app?

I am currently working on an app with the file sharing feature.
We have a view to ask the user to plug his device to iTunes to add files if there is no files in the app.
I would like to remove this view when the iOS app is launched on the device and when the user add at least one file with iTunes to the app.
Is there a way to do that with the default FileManager ? Like a delegate or something to detect events from the document directory of the app ?
I have looked on the web and found some pods but only for macOS.
I have also tried something with a Timer which will get the files from the document directory of the app each 0.25 seconds, but I don't think this is the best way to do what I want.
Thanks for your help.
EDIT:
Thanks to the MartinR's comment below, the following link helps me to do what I wanted
Notification if user modifies contents of documents directory via iTunes File sharing

Save audio file to a user-friendly location swift 3 avfoundation

I am writing a simple recorder application which can record/play audio (via. AVFoundation) and save it locally to the iOS device. I've found several sources de
Initially, I would have liked to send out multiple of these saved audio files via email (MessageUI) such as with this simple example: https://gist.github.com/kellyegan/49e3e11fe68b5e6b5360 - though recently I have felt maybe I should forego this in favor of simply saving to the device and allowing the user to send out the file somehow.
Considering this, I feel it might be best to try to save the audio file to a more user-friendly destination. Is there any way I can save these files locally that might allow the user to 'share' them via iOS (outside of my application)? Maybe even to their iTunes library? This seemed promising: iOS - Save audio files to iTunes music library - but looks like the solution provided is actually for saving images to the 'photo album'
When I print the audio file's URL I get something like
'file:///var/mobile/Containers/Data/Application/AA3E5177-A8C8-4FFA-8EBC-85A2A6844A88/Documents/recording-2017-03-06-12-54.m4a'
I am a serious noob w/ Swift 3 and definitely with AVFoundation - I'd really appreciate any and all help/advice. Thanks in advance!
The URL 'file:///var/mobile/Containers/Data/Application/AA3E5177-A8C8-4FFA-8EBC-85A2A6844A88/Documents/recording-2017-03-06-12-54.m4a' may look elaborate to you, but in fact it is totally "user-friendly". It's a file in the app's Documents folder! Nothing could be simpler than that.
The URL in question would never be seen by the user; in fact, it won't even be the same between runs of your app.
Your app can certainly provide interface for the user to select one or more files, and can make them available for sharing out by means of UIActivityViewController or UIDocumentInteractionController.
You might also want to look into UIDocumentPickerViewController or even https://developer.apple.com/library/content/documentation/General/Conceptual/ExtensibilityPG/FileProvider.html
iOS apps are heavily sandboxed. The app's Documents directory (at the path you posted) is the typical place for files like this. You can enable file sharing from the app in iTunes (on the user's computer) by adding the UIFileSharingEnabled key (Application supports iTunes file sharing) to your Info.plist file.
The typical way to enable sharing within the app is by using UIDocumentInteractionController or UIActivityViewController.

Is possible to save recorder audio file in musics in swift?

Hi in my app I have one feature to record audio and save it application directory. Client asking me is it possible to save audio file in musics?. That is client need to play recorded audio file without our application. I searched lot but cant find solution
No all iOS applications are sandboxed and the app data generated by the app cannot be used by other apps and can't to saved into other apps. The only way to share data between apps is through UIActivityViewController and it unfortunately does not provide any way of opening a file in music app. It is possible for jailbroken devices however.

IOS - Storing Audio and Videos outside App Sandbox

I am fairly new to IOS App Development. I have an app which plays audio and videos that are present in the App Package. Now I want my app to play audios and videos that are outside the App Package altogether i.e. if I uninstall my app the media files should not be deleted.
I have heard that all the apps can access media files that are added through ITunes. So I want to know the path of this folder(Kindly excuse me if you find my terminology vague. As I said I am fairly new to IOS App Development).
You cannot store the files outside app sandbox. Where as we can save image/video files to photos app
using, UIImageWriteToSavedPhotosAlbum/UISaveVideoAtPathToSavedPhotosAlbum
Please check developer documentation

Getting physical location of files in an IPad

I am new to IOS App Development. I am working in an IOS app for IPad that will read a json file which will have names of some audio files. It will then play those files. I have copied the files into iPad using FilesOnTree App (http://download.cnet.com/FilesOnTree-FREE-Tree-File-Explorer/3000-2064_4-75748813.html). I can now only see the files in this app. I want my iPad app to access this data. For that I will need physical location of these files in iPad. Is there a way to get the physical location of files in iPad.
And after getting the address of files, will it be possible to access the files from my app.
You cannot access file outside of your App's Sandbox, except if the files are shared by the system (i.e. photo library and music files), after obtaining the proper permission from the user.
If these are music files, like you say, you can access them through MPMediaQuery
and play them back with MPMusicPlayerController

Resources