Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
iimuy opened this issue Dec 28, 2023 · 3 comments

Comments

@iimuy
Copy link

iimuy commented Dec 28, 2023

你好部分机型偶发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
Copy link
Author

iimuy commented Dec 28, 2023

SDK的版本是(2.10.16)

@wlll129
Copy link
Contributor

wlll129 commented Feb 23, 2024

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

@iimuy
Copy link
Author

iimuy commented Feb 23, 2024

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

好的,谢谢啦。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants