In iPhone, how to store audio file picked from media picker to some directory?

1.2k views Asked by At

How can I write an audio file picked from mediaPicker into some particular folder? We are currently writing image to file path with this method:

[UIImagePNGRepresentation(image) writeToFile:pngPath atomically:YES];

Is it possible for to do the same kind of thing with an audio file?

Thanks.

1

There are 1 answers

5
Fran Sevillano On
- (BOOL)writeToFile:(NSString *)path atomically:(BOOL)flag

is a method of the NSData class, so, once you have fetched your audio from the media picker, you should totally be able to write it to a file that way.


Note: You might have to convert the audio picked to NSData first

Cheers