upload object failed, error: Error Domain=com.aliyun.oss.clientError Code=8 "(null)" UserInfo={ErrorMessage=Catch exception - *** -[__NSPlaceholderDictionary initWithObjects:forKeys:count:]: attempt to insert nil object from objects[0]}
服务器获取的阿里云信息如下:
put.bucketName
=
@
"dandan-image";
p
ut.
objectKey
=
@"uploads/other/201706/83361497869482";
put.
uplo
adingFileURL
= @"
file:///var/mobile/Containers/Data/Application/7A0BB1B7-A716-4B5B-8E7E-207F237F415B/Documents/images/B7133842-7AD1-4D2F-9F9A-EA235E67735B.jpg
"
上传代码:
OSSPutObjectRequest * put = [OSSPutObjectRequest new];
// required fields
put
.
bucketName
= BucketName;
put
.
objectKey
= OssFile;
put
.
uploadingFileURL
= [
NSURL
fileURLWithPath
:SourceFile];
NSLog
(
@"
uploadingFileURL
: %@"
, put.
uploadingFileURL
);
//put.
contentType
= @"";
//put.
contentMd5
= @"";
//put
.
contentEncoding = @"";
//put.
contentDisposition
= @"";
put.
objectMeta
= [
NSMutableDictionary
dictionaryWithObjectsAndKeys
: UpdateDate,
@"Date"
,
nil
];
OSSTask
* putTask = [
client
putObject
:put];
[putTask
continueWithBlock
:^
id
(
OSSTask
*task) {
NSLog
(
@"objectKey: %@"
, put.
objectKey
);
if
(!task.
error
) {
NSLog
(
@"upload object success!"
);
resolve(@YES);
} else {
NSLog(@"upload object failed, error: %@" , task.error);
reject(@"-1", @"not respond this method", nil);
}
return nil;
}];
-------------------------
版权声明:本文内容由阿里云实名注册用户自发贡献,版权归原作者所有,阿里云开发者社区不拥有其著作权,亦不承担相应法律责任。具体规则请查看《阿里云开发者社区用户服务协议》和《阿里云开发者社区知识产权保护指引》。如果您发现本社区中有涉嫌抄袭的内容,填写侵权投诉表单进行举报,一经查实,本社区将立刻删除涉嫌侵权内容。