aliyun / aliyun-oss-ios-sdk

iOS SDK for aliyun object storage service
Other
466 stars 319 forks source link

你好,部分机型偶发This operation need data or file to upload but none is set #369

Open iimuy opened 8 months ago

iimuy commented 8 months ago

你好部分机型偶发This operation need data or file to upload but none is set,我看看了本地存储的图片是存在的。 报错:upload object failed, error: Error Domain=com.aliyun.oss.clientError Code=3 "(null)" UserInfo={ErrorMessage=This operation need data or file to upload but none is set} 上传OSS的代码:

OSSPutObjectRequest * put = [OSSPutObjectRequest new];
put.bucketName = bucketName;
put.objectKey = [NSString stringWithFormat:@"%@.jpg",objectKey];
NSString *filePath = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES).firstObject;
filePath = [NSString stringWithFormat:@"%@/%@.jpg",filePath,filename];
[UIImageJPEGRepresentation(ImageObj, 0.5) writeToFile:filePath atomically:YES];
put.uploadingFileURL = [NSURL URLWithString:filePath];
put.uploadProgress = ^(int64_t bytesSent, int64_t totalByteSent, int64_t totalBytesExpectedToSend) {
    NSLog(@"%lld, %lld, %lld", bytesSent, totalByteSent, totalBytesExpectedToSend);
};
OSSTask * putTask = [_client putObject:put];
[putTask continueWithBlock:^id(OSSTask *task) {

}];
iimuy commented 8 months ago

SDK的版本是(2.10.16)

wlll129 commented 6 months ago

报这个错的原因是sdk检查到put对象的uploadingData和uploadingFileURL都为null,检查下是否会有设置null的情况

iimuy commented 6 months ago

报这个错的原因是sdk检查到put对象的uploadingData和uploadingFileURL都为null,检查下是否会有设置null的情况

好的,谢谢啦。