[英]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. 但是,如果文件是.5到2 mb,则使用GCD,NSOperationQueue或类似文件将读取操作发送到线程。
If you are targeting iOS7 and above you could try the new NSURLSession 如果您定位到iOS7及更高版本,则可以尝试新的NSURLSession
https://developer.apple.com/library/ios/documentation/Foundation/Reference/NSURLSession_class/Introduction/Introduction.html https://developer.apple.com/library/ios/documentation/Foundation/Reference/NSURLSession_class/Introduction/Introduction.html
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.