语音保存 ,与下载,
?1,先有文件名,然后給 這個路徑 寫入音頻數據,這就算保存到本地了,
??self.recordFilePath = [VoiceRecorderBaseVCgetPathByFileName:recordFileNameofType:@"wav"];
? ??self.recorder = [[[AVAudioRecorderalloc]initWithURL:[NSURLURLWithString:recordFilePath]
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? settings:[VoiceRecorderBaseVC getAudioRecorderSettingDict]
?? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? error:nil]autorelease];
2,targetPath,下載到指定路徑,
? ??AFDownloadRequestOperation *downloadOperation = [[AFDownloadRequestOperation alloc] initWithRequest:request targetPath:targetPath shouldResume:shouldResume];
3,生成一個?NSOperationQueue隊列,只有向其中 添加?AFDownloadRequestOperation,那么便會自動調用,
? ? ? ??[downloadQueue addOperation:downloadOperationOri];
? ? ? ? AFDownloadRequestOperation
4,這玩意 據說是 監聽下載進程的,比如下載了 10%,11% etc,
[downloadOperation setProgressiveDownloadProgressBlock:^(AFDownloadRequestOperation *operation, NSInteger bytesRead, long long totalBytesRead, long long totalBytesExpected, long long totalBytesReadForFile, long long totalBytesExpectedToReadForFile) {
? ? ? ? [selfdownloadOperation:operation progressTotalBytesReadForFile:totalBytesReadForFile totalBytesExpectedToReadForFile:totalBytesExpected];
? ? }];
上傳進程,
- (void)setUploadProgressBlock:(void (^)(NSUInteger bytesWritten, long long totalBytesWritten, long long totalBytesExpectedToWrite))block {
? ? self.uploadProgress = block;
}
下載進程,
?- (void)setDownloadProgressBlock:(void (^)(NSUInteger bytesRead, long long totalBytesRead, long long totalBytesExpectedToRead))block {
? ? self.downloadProgress = block;
}
5,AFNetWorking,
AFJSONRequestOperation,
NSMutableURLRequest,
NSOperationQueue,
6,nsrequest,nsconnection
7,nsoperation,nsoperationqueue,
8,socket,stream,
9,流程
支持協議:??? ??文件傳輸協議(ftp://) ??超文本傳輸協議(http://) ??安全128-bit超文本傳輸協議(https://) ??本地文件路徑(file:///) 訪問URL步驟: ??構造NSURL,,使用NSURL構造一個URL ??生成一個NSURLRequest,使用NSURLRequest構造一個請求 ??通過NSURLConnection發送請求,使用NSURLConnection發送一個請求,并返回數??通過返回的NSURLResponse和NSError分析結果 ,使用NSURLResponse和NSError來監測響應和錯誤信息 10,
-(void)network
{
? ? NSURLConnection *connection;
? ? connection = [connection initWithRequest:[NSURLRequestrequestWithURL:[NSURLURLWithString:@"http://baidu.com"]] delegate:self];
? ? [connection start];
}
- (void)connection:(NSURLConnection *)connection didFailWithError:(NSError *)error
{? ??
}
11,pragma
/* The file type to record is inferred from the file extension. Will overwrite a file at the specified url if a file exists */
- (id)initWithURL:(NSURL *)url settings:(NSDictionary *)settings error:(NSError **)outError;
轉載于:https://www.cnblogs.com/guligei/p/3526570.html
總結
以上是生活随笔為你收集整理的语音保存 ,与下载,的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 日志审计的必要性
- 下一篇: gzcms技术开发文档