解决了语音上传到问题,接下来要解决下载播放问题
This commit is contained in:
73
Pods/Qiniu/QiniuSDK/Storage/QNFormUpload.m
generated
Normal file
73
Pods/Qiniu/QiniuSDK/Storage/QNFormUpload.m
generated
Normal file
@@ -0,0 +1,73 @@
|
||||
//
|
||||
// QNFormUpload.m
|
||||
// QiniuSDK
|
||||
//
|
||||
// Created by bailong on 15/1/4.
|
||||
// Copyright (c) 2015年 Qiniu. All rights reserved.
|
||||
//
|
||||
#import "QNDefine.h"
|
||||
#import "QNLogUtil.h"
|
||||
#import "QNFormUpload.h"
|
||||
#import "QNResponseInfo.h"
|
||||
#import "QNUpProgress.h"
|
||||
#import "QNRequestTransaction.h"
|
||||
|
||||
@interface QNFormUpload ()
|
||||
|
||||
@property(nonatomic, strong)QNUpProgress *progress;
|
||||
|
||||
@property(nonatomic, strong)QNRequestTransaction *uploadTransaction;
|
||||
|
||||
@end
|
||||
|
||||
@implementation QNFormUpload
|
||||
|
||||
- (void)startToUpload {
|
||||
[super startToUpload];
|
||||
|
||||
QNLogInfo(@"key:%@ form上传", self.key);
|
||||
|
||||
self.uploadTransaction = [[QNRequestTransaction alloc] initWithConfig:self.config
|
||||
uploadOption:self.option
|
||||
targetRegion:[self getTargetRegion]
|
||||
currentRegion:[self getCurrentRegion]
|
||||
key:self.key
|
||||
token:self.token];
|
||||
|
||||
kQNWeakSelf;
|
||||
void(^progressHandler)(long long totalBytesWritten, long long totalBytesExpectedToWrite) = ^(long long totalBytesWritten, long long totalBytesExpectedToWrite){
|
||||
kQNStrongSelf;
|
||||
[self.progress progress:self.key uploadBytes:totalBytesWritten totalBytes:totalBytesExpectedToWrite];
|
||||
};
|
||||
|
||||
[self.uploadTransaction uploadFormData:self.data
|
||||
fileName:self.fileName
|
||||
progress:progressHandler
|
||||
complete:^(QNResponseInfo * _Nullable responseInfo, QNUploadRegionRequestMetrics * _Nullable metrics, NSDictionary * _Nullable response) {
|
||||
kQNStrongSelf;
|
||||
|
||||
[self addRegionRequestMetricsOfOneFlow:metrics];
|
||||
|
||||
if (!responseInfo.isOK) {
|
||||
if (![self switchRegionAndUploadIfNeededWithErrorResponse:responseInfo]) {
|
||||
[self complete:responseInfo response:response];
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
[self.progress notifyDone:self.key totalBytes:self.data.length];
|
||||
[self complete:responseInfo response:response];
|
||||
}];
|
||||
}
|
||||
|
||||
- (QNUpProgress *)progress {
|
||||
if (_progress == nil) {
|
||||
_progress = [QNUpProgress progress:self.option.progressHandler byteProgress:self.option.byteProgressHandler];
|
||||
}
|
||||
return _progress;
|
||||
}
|
||||
|
||||
- (NSString *)upType {
|
||||
return QNUploadUpTypeForm;
|
||||
}
|
||||
@end
|
||||
Reference in New Issue
Block a user