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,流程
-(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;