iPhone SDK: How can I write an audio file picked from iPod Library into my app's Documents Folder?

2.3k views Asked by At

How can I write an audio file picked from mediaPicker into my app's Documents Folder?

Basically I am selecting a audio file from iPod Library.

I want that this selected file be copied into my app's Documents folder.

So that I can reference it from my app's Documents folder.

What can be done?

Thanks.

3

There are 3 answers

0
Meghan On BEST ANSWER

I found a way to convert iPod libray song and write it to documents directory, using

From iPod Library to PCM Samples in Far Fewer Steps Than Were Previously Necessary

Thanks Mats Stijlaart for your help. But I got the solution for this.

Hope this helps everyone.

2
Mats Stijlaart On

I do not think this is allowed. This will make it more easy to copy file bought in iTunes, so i do not think apple will allow that.

When you pick music from your music library, you will have to use a MPMediaPickerController with the following delegate method:

- (void) mediaPicker: (MPMediaPickerController *) mediaPicker didPickMediaItems: (MPMediaItemCollection *) mediaItemCollection

MPMediaItemCollection is some kind of list. It's items are instances of the MPConcreteMediaItem class. The MPMusicPlayerController can play a MPMediaItemCollection, but with MPConcreteMediaItems but you can not do anything.

0
Ilias Karim On