简体   繁体   中英

how to read recorded audio(binary) file to upload in iOS

我有一个音频文件(二进制)文件,存储在文档文件夹中的文件中,我想从文件中读取数据并使用php脚本上传到服务器,我的问题是从磁盘读取此文件的最佳方法是什么?

You can simply use

NSData *fileData = [[NSData alloc] initWithContentsOfFile:@"My File Path"];

to read the contents of the file. But if the file is .5 to 2 mb, sent the read operation to a thread using GCD, NSOperationQueue or Similar.

If you are targeting iOS7 and above you could try the new NSURLSession

https://developer.apple.com/library/ios/documentation/Foundation/Reference/NSURLSession_class/Introduction/Introduction.html

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM