语音保存 ,与下载,

 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