开发者

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

开发者 https://www.devze.com 2023-02-07 00:26 出处:网络
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:

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(im开发者_C百科age) writeToFile:pngPath atomically:YES];

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

Thanks.


- (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

0

精彩评论

暂无评论...
验证码 换一张
取 消