如何在 iOS 中录制音频并将其作为 NSData 获取?
How to record audio and get it as NSData in iOS?
我想在我的应用程序中录制一些内容,然后 post 将其录制到 API。
请帮忙
您可以按照此 link 在本地 iPhone 存储(例如:文档目录)中录制和保存音频。
Record audio file and save locally on iPhone
保存后,您可以将文件内容转换为 NSData
NSDate *audioData = [NSData dataWithContentsOfFile:audioFilePath];
// audioFilePath is the path of audio either from document
// directory or any other location.
这个简单的教程可能对您有所帮助
https://www.appcoda.com/ios-avfoundation-framework-tutorial/
完成录制后,您必须选择是否要
AFNetworking or NSURLConnection
将音频发送到服务器
我想在我的应用程序中录制一些内容,然后 post 将其录制到 API。 请帮忙
您可以按照此 link 在本地 iPhone 存储(例如:文档目录)中录制和保存音频。
Record audio file and save locally on iPhone
保存后,您可以将文件内容转换为 NSData
NSDate *audioData = [NSData dataWithContentsOfFile:audioFilePath];
// audioFilePath is the path of audio either from document
// directory or any other location.
这个简单的教程可能对您有所帮助
https://www.appcoda.com/ios-avfoundation-framework-tutorial/
完成录制后,您必须选择是否要
AFNetworking or NSURLConnection
将音频发送到服务器