iOS上传回调失败
ReiOS上传回调失败
OSSPutObjectRequest
*request = [OSSPutObjectRequest
new
];
request.
bucketName =
@'yayi-avatar';
request.
objectKey = [
NSString
stringWithFormat:
@'doctor2/%@.jpg',[
self
MD5:append]];
request.
callbackParam =
@{
@'callbackUrl':url,
@'callbackBody'
:@'ossurl=http://${bucket}.oss-cn-hangzhou.aliyuncs.com/${object}&userid=${x:userid}'
};
request.
callbackVar =
@{
@'x:userid':userid
};
request.
uploadingData = data;
request.
contentType =
@'image/jpeg';
request.
uploadProgress = ^(
int64_t bytesSent,
int64_t totalByteSent,
int64_t totalBytesExpectedToSend) {
NSLog(
@'%lld, %lld, %lld', bytesSent, totalByteSent, totalBytesExpectedToSend);
};
OSSTask * task = [
client
putObject:request];
[task
continueWithBlock:^
id(
OSSTask *task) {
if (!task.
error) {
OSSPutObjectResult *result = task.
result;
NSLog
(@'upload object success!'
);
}
else {
fail(
true);
NSLog
(
@'upload object failed, error: %@'
, task.
error
);
}
return
nil;
}];
赞0
踩0